Performs a Least Squares Polynomial fit.
POLYFIT(y, x, order, overwrite, form, method, "specfile")
y 
 
A series or table.  
x 
 
Optional. A series or table, the explicit X values. Defaults to the X values of y.  
order 
 
An integer, the order of the polynomial fit.  
overwrite 
 
Optional. An integer, the overwrite flag for existing "specfile":  


 
form 
 
Optional. An integer, the polynomial coefficient form:  


 
method 
 
Optional. An integer, the least squares fitting method:  


 
"specfile" 
 
Optional. A string, the name of summary statistics file. Defaults to "polyN.fit". 
A series of coefficients.
W1: gline(100,.01,1.0,1.0)^2
W2: polyfit(W1, 3)
returns a 4 point series with values {1.0, 2.0, 1.0, 5.89E14} as the resulting 3rd order coefficients, a[1], a[2], a[3], a[4].
W3: polygraph(W2, xvals(W1))
graphs the fit.
POLYFIT also works with XY data. For example:
W1: xy(gexp(100, 0.01), gsin(100, 0.01))
W2: polyfit(W1, 5)
W3: polyfit(W1, xvals(W1), 5)
W4: polygraph(W2, xvals(W1), 1)
W2 and W3 produce the same coefficients. The last parameter of 1 in the POLYGRAPH function creates an explicit XY graph.
polyfit(series, N) performs a least squares fit of a series to
where y is the input series and N is the order of the fit.
POLYFIT returns the coefficients, a[k], of the above power series.
If form is 1 then:
The default QR decomposition method (method = 0) is slower, but more accurate than the GaussJordan elimination method and is preferred for high order fits. However, GaussJordan may be preferred for low order fits where speed is an important factor.
For a tabular view of the coefficients, use the TABLEVIEW function in the Window containing the results of the POLYFIT operation.
See PFIT to fit a polynomial with error statistics.
See LINFIT to fit linear combination of arbitrary basis functions to a series using the method of least squares.
See POLYGRAPH or POLYVAL to evaluate the resulting polynomial.
See DADiSP/MatrixXL to significantly optimize POLYFIT for the QR method.