Returns the coefficients of a polynomial fitted to the supplied function data.
Format
POLYFIT (x, y, order)
Arguments
x | Array of x values. |
y | Array of y values. |
order | Maximum order of the polynomical. The coefficients are returned in increasing order (from zeroth order to this value). |
Examples
The following commands produce the array result.
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))
Array result:
[1.0, 1.2, 2.5, 2.0, 0.0, 0.0]
The coefficients are ordered from the zeroth order to the nth order, from left to right.