Fit a polynomial to a list of dpoints.
- Parameters:
-
| poly_deg | Degree of the polynomial to fit. |
| list | List of dpoints. |
| np | Number of points in the list. |
| mse | Output mean squared error. |
- Returns:
- Array of (np+1) polynomial coefficients.
The fitted polynomial is such that: \[ P(x) = c_0 + c_1 x + c_2 x^2 + ... + c_n x^n \] So requesting a polynomial of degree n will return n+1 coefficients. Beware that with such polynomials, two input points shall never be on the same vertical!
If you are not interested in getting the mean squared error back, feed in NULL instead of a pointer to a double for mse.
|