Polyfit

Parent Previous Next

Polyfit


Least square polynomial curve fitting


Syntax


polyfit(x, y, m)

x,y are vectors of the same size, m is an positive integer and m>=2

The input vectors x, y contains the data points for the curve fitting. Each data point is given by (x[i], y(i)). polyfit(x,y,m) return a vector whose elements are the coefficients of the polynomial fitting function. m is the order of the polynomial fitting function.


Example


Input

Output

x = linspace(0, 2*PI/30.0)

y = sin(x)

polyfit(x,y,8)


See Also


Created with the Personal Edition of HelpNDoc: Easily create EPub books