Performs known frequency sine curve fitting using the least squares method.
LSINFIT(series, freq, mode)
series 
 
A series, the input sinusoid. 

freq 
 
A real, the known frequency of the input signal. 

mode 
 
Optional. An integer, the sinusiod form:

A series and optionally the coefficients and rms error of the fitted curve.
W1: gsin(1000, .001, 4)
W2: lsinfit(w1, 4, 0)
Fits the generated data to the function:
W1: gsin(1000, .001, 4)
(fit, coef) = lsinfit(w1, 4, 1)
W2: fit
W3: coef
Fits the generated data to the function:
W2 will contain the fitted curve and W3 will contain the coefficients in the form:
coef = {A, theta, C, rmserror}
The known frequency approach to sine curve fitting is commonly used in effective bits calculation. The output of the function is dependant on knowing the frequency of the input series.
See SINFIT3 to perform a sinusoid fit with a known or unknown frequency.
SINFIT4 to perform an iterative least squares sinusoid fit.
IEEE Std 10571994 Annex A "Derivation of three parameter (known frequency) sine wave curve fit algorithm"