Statistics Toolbox
  Go to function:
    Search    Help Desk 
polyfit    Examples   See Also

Polynomial curve fitting.

Syntax

Description

p = polyfit(x,y,n) finds the coefficients of a polynomial p(x) of degree n that fits the data, p(x(i)) to y(i), in a least-squares sense. The result p is a row vector of length n+1 containing the polynomial coefficients in descending powers.


[p,S] = polyfit(x,y,n) returns polynomial coefficients p, and matrix, S for use with polyval to produce error estimates on predictions. If the errors in the data, y, are independent normal with constant variance, polyval will produce error bounds which contain at least 50% of the predictions.

You may omit S if you are not going to pass it to polyval or polyconf for calculating error estimates.

Example

See Also

polyfit is a function in MATLAB.



[ Previous | Help Desk | Next ]