The features described in this topic are obsolete
and should not be used in new IDL code.

POLYFITW

This routine is obsolete and should not be used in new IDL code. To perform a weighted polynomial fit, use the MEASURE_ERRORS keyword to POLY_FIT.

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.

Syntax

Result = POLYFITW(X, Y, Weights, NDegree [, Yfit, Yband, Sigma, Corrm] [, /DOUBLE] [, STATUS=variable] )

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.

Keywords

DOUBLE

Set this keyword to force computations to be done in double-precision arithmetic.

STATUS

Set this keyword to a named variable to receive the status of the operation. Possible status values are: