Implementing curve fit using least squares method in C ++
I am trying to write a C ++ function to perform curve fitting using the least squares method. Input parameters of this function are x
both y
1D array and n
. And this function finds the coefficients of the p(x)
degree polynomial n
that match the data p(x(i))
to y(i)
in the least squares sense. Therefore, the function returns a 1D array.
could you help me?
a source to share
Here's a basic method via MathWorld (a great resource). For C ++ code, refer to your local library and look at Numerical Recipes .
a source to share