Standard Library function thatfits an n-degree polynomial curve through a set of data points using the least-squares method.
y
wt
deg
ybd
sig
mat
x = FINDGEN(9) y = [5., 4., 3., 2., 2., 3., 5., 6., 7.]
TEK_COLOR PLOT, x, y, Title='POLYFITW EXAMPLE'
wt = FLTARR(9) + 1.0 coeff_no_wt = POLYFITW(x, y, wt, 1, yfit)
OPLOT, x, yfit, Color=3
wt = 1.0/y coeff_stat_wt = POLYFITW(x, y, wt, 1, yfit)
OPLOT, x, yfit, Color=2
labels=['Original data',$ 'Fit with no weighting',$ 'Fit with statistical weighting'] LEGEND, labels, [255, 3, 2], [0, 0, 0], $ [0, 0, 0], 4., 1.5, .3