Functions > Data Analysis > Curve Fitting > Linear Combination of Functions
Linear Combination of Functions
linfit(vx, vy, F)—Returns a vector containing the parameters used to create a linear combination of the functions in vector F which best approximates the data in vx and vy in the least-squares sense.
While data does not always follow a straight line, it can often be fit by a function which is a linear sum of terms. The terms do not have to be linear in the independent variable, but they must be linear in the parameter which multiplies the term in order to be considered a linear fit.
vx, vy are vectors of real data values of the same length, corresponding to the x and y values in the data set. There must be at least as many data points as there are terms in F.
F(x) is a vector of functions; each element is one linear functional term in the fit function. In the case of a single linear function, F is a scalar.
You should provide only the name of the vector of functions, without any arguments, to linfit.
Was this helpful?