Is A Matlab Function That Computes A Least Squares Polynomial For A Given Set of Data
Is A Matlab Function That Computes A Least Squares Polynomial For A Given Set of Data
Matlab has two functions, polyfit and polyval, which canquickly and
easily fit a set of data points with a polynomial. The equation for a polynomial line is: ... Polyfit
is a Matlab function that computes a least squares polynomial for a given set of data.
The linspace function generates linearly spaced vectors. It is similar to the colon operator ":",
but gives direct control over the number of points. y = linspace(a,b) generates a row vector y of
100 points linearly spaced between a and b. y =linspace(a,b,n) generates n points
fit(x,y,fitType) creates the fit to the data in x and y with the model specified by fitType.
example
fitobject = fit([x,y],z,fitType) creates a surface fit to the data in vectors x, y, and z.
example
fitobject = fit(x,y,fitType,fitOptions) creates a fit to the data using the algorithm options
specified by the fitOptions object.
Residuals are useful for detecting outlying y values and checking the linear regression assumptions with
respect to the error term in the regression model. High-leverage observations have smaller residuals
because they often shift the regression line or surface closer to them