POLYFITW
The
POLYFITW function performs a weighted
least-square polynomial
fit with optional error estimates and returns a vector of coefficients with a length of
NDegree
+1.
The POLYFITW routine uses matrix inversion. A newer version of this routine, SVDFIT, uses Singular Value Decomposition. The SVD technique is more flexible, but slower. Another version of this routine, POLY_FIT, performs a least square fit without weighting.
This routine is written in the IDL language. Its source code can be found in the file
polyfitw.pro
in the
lib
subdirectory of the IDL distribution.
Calling Sequence
Result = POLYFITW(
X, Y, Weights, NDegree [,Yfit, Yband, Sigma, Corrm]
)
Arguments
X
An
n
-element vector of independent variables.
Y
A vector of independent variables, the same length as
X
.
Weights
A vector of weights, the same length as
X
and
Y
.
NDegree
The degree of the polynomial to fit.
Yfit
A named variable that will contain the vector of calculated
Y
values. These values have an error of plus or minus
Yband
.
Yband
A named variable that will contain the error estimate for each point.
Sigma
A named variable that will contain the standard deviation of the returned coefficients.
Corrm
A named variable that will contain the correlation matrix of the coefficients.