Linefit

Parent Previous Next

Linefit


Least square straight line curve fitting


Syntax


linefit(x, y)

x,y are vectors of the same size

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


Example


Input

Output

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

y = sin(x)

linefit(x,y)


See Also


Created with the Personal Edition of HelpNDoc: Produce Kindle eBooks easily