Mathematics |
Polynomial Curve Fitting
polyfit
finds the coefficients of a polynomial that fits a set of data in a least-squares sense.
x
and y
are vectors containing the x and y data to be fitted, and n
is the order of the polynomial to return. For example, consider the x-y test data.
A third order polynomial that approximately fits the data is
Compute the values of the polyfit
estimate over a finer range, and plot the estimate over the real data values for comparison.
To use these functions in an application example, see the Data Analysis and Statistics chapter.
Polynomial Derivatives | Partial Fraction Expansion |