<< expofit Curve Fitters (curvefit) npolyfit >>

Curve Fitters (curvefit) >> Curve Fitters (curvefit) > linefit

linefit

Fit a given set of data-points to a line. Returns the fitted data points, slope and the intercept of the line.

Calling Sequence

[yfit,m,c] = linefit(x,y)

Arguments

x

an array of x axis points

y

an array of y axis points

yfit

an array that contains the fitted points

m

slope of the fitted line

c

intercept of the fitted line

Description

Fit a given set of data-points to a line.

Returns the fitted data points, slope and the intercept of the line.

Examples

x=[1,2,3,4,5];
y=[2,4,6,8,10];
[yfit,m,c]=linefit(x,y)

See Also


Report an issue
<< expofit Curve Fitters (curvefit) npolyfit >>