Mathematics Previous page   Next Page

Polynomial Regression

Based on the plot, it is possible that the data can be modeled by a polynomial function

The unknown coefficients a0, a1, and a2 can be computed by doing a least squares fit, which minimizes the sum of the squares of the deviations of the data from the model. There are six equations in three unknowns,

represented by the 6-by-3 matrix

The solution is found with the backslash operator.

The second-order polynomial model of the data is therefore

Now evaluate the model at regularly spaced points and overlay the original data in a plot.

Clearly this fit does not perfectly approximate the data. We could either increase the order of the polynomial fit, or explore some other functional form to get a better approximation.


Previous page  Regression and Curve Fitting Linear-in-the-Parameters Regression Next page

© 1994-2005 The MathWorks, Inc.