Returns the coefficients of a polynomial fitted to the supplied function data.
Format
POLYFIT (x, y, order)
Arguments
x | The array of x values. |
y | The array of y values. |
order | The maximum order of the polynomial, the returned coefficients are from 0th order to this value. |
Examples
The following commands:
var cre var=xx rea=(series2(0, 20, 20))
var cre var=yy rea=(1.0 + 1.2*xx + 2.5*xx**2 + 2.0*xx**3)
var cre var=pp rea=(polyfit(xx, yy, 5))
produce the array result.
The coefficients are ordered from the 0th order to the nth order from left to right.
[1.0, 1.2, 2.5, 2.0, 0.0, 0.0]