Computes the exponential moving average.
EXPMOVAVG(series, a, yi)
series |
- |
A series or table. |
a |
- |
Optional. A real, the smoothing factor where |
yi |
- |
Optional. A real, the initial value. Defaults to series[1], the first input value. |
EXPMOVAVG(series, N, yi)
series |
- |
A series or table. |
N |
- |
Optional. An integer, the effective number of points to average where |
yi |
- |
Optional. A real, the initial value. Defaults to series[1], the first input value. |
A series, the exponential moving average.
W1: 1..5
W2: expmovavg(w1, 0.5)
W2 == {1.0, 1.5, 2.25, 3.125, 4.0625}
The XOFFSET of the result is 1.0.
W1: 1..5
W2: expmovavg(w1, 3)
W2 == {1.0, 1.5, 2.25, 3.125, 4.0625}
Same as above except the smoothing factor is in the form of the effective number of points to smooth. The effective number of points, N is related to a, the smoothing factor by:
N = (2 / a) - 1
W1: integ(gnorm(1000, 1/100))
W2: expmovavg(w1, 0.7)
W3: expmovavg(w1, 0.1)
W1 contains 1000 samples of synthesized data.
W2 performs a standard exponential moving average with a smoothing factor of 0.7.
W3 performs a standard exponential moving average by with a smoothing factor of 0.1.
The degree of smoothing is increased as the smoothing factor approaches 0.0. The degree of smoothing is decreased as the smoothing factor approaches 1.0.
EXPMOVAVG computes the exponential moving average with a smoothing factor using the following difference equation:
y[n] = a x[n] + (1 - a) y[n - 1]
where a is the smoothing factor for 0 <= a <= 1. The smoothing effect decreases as a approaches 1, with no smoothing for a = 1.0.
EXPMOVAVG uses FILTEQ to implement the difference equation.
By default, y[0] = yi = x[1].
The effective number of points to average, N, is related to the smoothing factor a, by:
N = (2 / a) - 1
where N is similar to the number of points to average as with the standard moving average. If the smoothing parameter of EXPMOVAVG is an integer greater or equal to 1, it is assumed to be the effective number of points as determined above.
See LINEXPAVG to compute an exponential moving average with zero phase shift to preserve peak locations.