Fit• Fit[data, funs, vars] finds a least-squares fit to a list of data as a linear combination of the functions funs of variables vars. • The data can have the form {{ , , ... , }, { , , ... , }, ... }, where the number of coordinates x, y, ... is equal to the number of variables in the list vars. • The data can also be of the form { , , ... }, with a single coordinate assumed to take values 1, 2, ... . • The argument funs can be any list of functions that depend only on the objects vars. • Fit[{ , , ... }, {1, x, x^2}, x] gives a quadratic fit to a sequence of values . The result is of the form + x + x^2, where the are real numbers. The successive values of x needed to obtain the are assumed to be 1, 2, ... . • Fit[{{ , }, { , }, ... }, {1, x, x^2}, x] does a quadratic fit, assuming a sequence of x values . • Fit[{{ , , }, ... }, {1, x, y}, {x, y}] finds a fit of the form + x + y. • Fit always finds the linear combination of the functions in the list forms that minimizes the sum of the squares of deviations from the values . • See also: Interpolation, LocateMinimum, SolveEquation.
Examples Using InstantCalculatorsHere are the InstantCalculators for the Fit function. Enter the parameters for your calculation and click Calculate to see the result.
Out[1]= |  |
Out[2]= |  |
Out[3]= |  |
You will have to evaluate the following cells in this example to generate the data used for the plots. Here is a table of the fifteenth through the twentieth Fibonacci numbers. Here is a plot of this data.
This gives a quadratic fit to the data.
Out[6]= |  |
Here is a plot of the quadratic fit.
This shows the quadratic fit superimposed on the original data.
Clear the variable definitions. This gives a table of the values of an exponential function for x from 1 to 10 in steps of 1.
Out[10]= |  |
This fit recovers the original functional form.
Out[11]= |  |
If you include other functions in the list, Fit determines that they occur with small coefficients.
Out[12]= |  |
Clear the variable definition.
|