data fitting with php
am 06.09.2007 17:01:28 von saudepp
Hi php pros,
I have an array containing n numbers and want to fit them to e.g. a
polynomial function f(x), x=1...n.
Is there a php script / library for doing that?
I basically wish to do curve fitting to my data array, directly in
php.
Ideal would be something like polyfit in MatLab.
One possibility would be to involve a c++ program doing the data
fitting. Export the array as a dump file from php, execute the
compiled c++ polynomial fitting file program calling the dump file and
saving the result, and then open the result file in php. Thats of
course not so elegant ...
Thanks for any help.
Best
-saudepp
Re: data fitting with php
am 06.09.2007 19:24:53 von shimmyshack
On Sep 6, 4:01 pm, "saud...@googlemail.com"
wrote:
> Hi php pros,
>
> I have an array containing n numbers and want to fit them to e.g. a
> polynomial function f(x), x=1...n.
>
> Is there a php script / library for doing that?
>
> I basically wish to do curve fitting to my data array, directly in
> php.
>
> Ideal would be something like polyfit in MatLab.
> One possibility would be to involve a c++ program doing the data
> fitting. Export the array as a dump file from php, execute the
> compiled c++ polynomial fitting file program calling the dump file and
> saving the result, and then open the result file in php. Thats of
> course not so elegant ...
>
> Thanks for any help.
>
> Best
>
> -saudepp
there are COM objects (sold) which you can invoke from within PHP,
other than that, writing your own spline model seems a challenge just
to avoid the inelegance of using an existing c++ program.
dont reinvent the wheel eh!
by f(x) do you mean a cubic polynomial?
Re: data fitting with php
am 06.09.2007 20:22:41 von saudepp
On Sep 6, 7:24 pm, shimmyshack wrote:
> On Sep 6, 4:01 pm, "saud...@googlemail.com"
> wrote:
>
>
>
> > Hi php pros,
>
> > I have an array containing n numbers and want to fit them to e.g. a
> > polynomial function f(x), x=1...n.
>
> > Is there a php script / library for doing that?
>
> > I basically wish to do curve fitting to my data array, directly in
> > php.
>
> > Ideal would be something like polyfit in MatLab.
> > One possibility would be to involve a c++ program doing the data
> > fitting. Export the array as a dump file from php, execute the
> > compiled c++ polynomial fitting file program calling the dump file and
> > saving the result, and then open the result file in php. Thats of
> > course not so elegant ...
>
> > Thanks for any help.
>
> > Best
>
> > -saudepp
>
> there are COM objects (sold) which you can invoke from within PHP,
> other than that, writing your own spline model seems a challenge just
> to avoid the inelegance of using an existing c++ program.
> dont reinvent the wheel eh!
> by f(x) do you mean a cubic polynomial?
Hi,
I meant with f(x) a polynomial of any order g.
I have done it now with an external c++.
Here's the current result:
http://www.kampfpapst.com/daxprognose/mod/kurs-prognose.php? dt=20
with order g=5.
Would be good to include other fitting methods like spline,
interpolation etc.
Do libraries exist for that in php? Or c++ ...?
Thanks -saudepp