polyfit
Polynomial least squares curve fit function.
Syntax
polyfit(indep_vec, dep_vec, order, [0|1, 0-15])
Argument
- indep_vec
- The independent vector of the curve to be fit (vector expression).
- dep_vec
- The dependent vector of the curve to be fit (vector expression).
- order
- The order of the resultant polynomial (scalar expression).
- 0,1
-
- 0
- If this optional parameter is included, the function behaves as if there are only three arguments.
- 1
- If this optional parameter is included, the polynomial coefficients are returned instead of the vectors.
- 0-15
- This optional argument defines the number of coefficient digits output to the Message Log.
Example
Curve Math Vectors | Results |
---|---|
x = c1.x
|
Given c1, a curve is created which is an eighth-order polynomial fit of curve c1. |
x = c1.x
|
Returns the eight coefficients with a precision of 10. |
Comments
The result is the polynomial of the specified order which best fits the original curve as determined by least squares criteria. indep_vec and dep_vec must have the same number of elements. order can be from zero to 20. If the order is greater than 20, the maximum value of 20 is used. polyfit also reports the polynomial coefficients and the correlation coefficient and mean deviation.