## functions in fitlsq.i - f

fitlsq

yp= fitlsq(y, x, xp) ... yfit= interp(yp, xp, xfit) performs a least squares fit to the data points (X, Y). The input XP are the abcissas of the piecewise linear function passing through (XP, YP) which is the best fit to the data (X,Y) in a least squares sense. The XP must be strictly monotone, either increasing or decreasing. As for interp, the piecewise linear fit is taken to be constant outside the limits of the XP. The result YP is linearly interpolated through any consecutive intervals of XP which contain no data points X, and linearly extrapolated beyond the extreme values of X (if any of the intervals of XP lie outside these extremes). A WEIGHT keyword of the same length as X and Y may be supplied in order to weight the various data points differently; a typical WEIGHT function is 1/sigma^2 where sigma are the standard deviations associated with the Y values. Interpreted function, defined at i/fitlsq.i line 10SEE ALSO: interp