Fits a line to a series using only the end points.
A series or array.
W2: lfit(W1);overplot(W1, lred)
W2 contains a linear fit of the data that exactly passes through the first and last point of W1. The resulting line is plotted with the original data.
W3: xy(W1, deriv(W1))
W4: lfit(W3);overplot(W3, lred)
W4 contains the end point linear fit to the XY data in W3.
The first and last points of the resulting line will always match the first and last points of the input series.
See LINREG and LINREG2 to fit a line to the data using the method of least squares.