Fits y(x) = A + Bx + C sin(Dx + E) using the FFT.
SINTREND(series)
(fit, coef) = SINTREND(series)
series |
- |
A series or array. |
A series, the fitted sine curve.
(fit, coef) = sintrend(series)
returns both the fit and the coefficients as a series.
W1: 5 + 3 * gsin(1000, .001, 10) + gline(1000, .001, 20, 0)
W2: sintrend(W1);overp(W1, lred)
overplots the original data with the calculated sine fit.
(fit, coef) = sintrend(W1)
fit is the same series as in W2
coef == {5.2861, 19.4272, 3.0032, 62.8249, 0.0035}
Note: since D == coef[4] == 2*pi*F, in this case, F = 62.8249 / (2π) = 9.9989.
SINTREND first calculates and removes the linear trend in the data, fits a sine, then adds in the calculated linear trend. The resulting fit is of the following form:
The frequency and phase terms are in radians.
SINTREND uses SINFIT to find the dominant frequency present in the series.