This module is part of the collection, A First Course in Electrical and Computer Engineering. The LaTeX source files for this collection were created using an optical character recognition technology, and because of this process there may be more errors than usual. Please contact us if you discover any errors.
Moving averages are generalizations of weighted averages. They are designed to “run along an input sequence, computing weighted averages as they go.” A typical moving average over N inputs takes the form
x
n
=
∑
k
=
0
N
-
1
w
k
u
n
-
k
=
w
0
u
n
+
w
1
u
n
-
1
+
⋯
+
w
N
-
1
u
n
-
(
N
-
1
)
.
x
n
=
∑
k
=
0
N
-
1
w
k
u
n
-
k
=
w
0
u
n
+
w
1
u
n
-
1
+
⋯
+
w
N
-
1
u
n
-
(
N
-
1
)
.
(1)
The most current input,
u
n
u
n
, is weighted by
w
0
w
0
; the next most current input,
un-1un-1, is weighted by
w
1
w
1
; and so on. This weighting is illustrated in Figure 1.
The sequence of weights,
w
0
w
0
through wN-1wN-1, is called a “window,” a “weighting
sequence,” or a “filter.” In the example illustrated in Figure 6.8, the current
value
u
n
u
n
is weighted more heavily than the least current value. This is typical
(but not essential) because we usually want
x
n
x
n
to reflect more of the recent
past than the distant past.
When the weights w0,w1,...,wN-1w0,w1,...,wN-1 are all equal to 1N1N, then the moving average
x
n
x
n
is a “simple moving average”:
xn=1N[un+un-1+⋯+uN-1].xn=1N[un+un-1+⋯+uN-1].
(2)This is the same as the simple average, but now the simple average moves along the sequence of inputs, averaging the
N
N most current values.
Evaluate the moving average xn=∑k=0N-11Nun-kxn=∑k=0N-11Nun-k for the inputs
- (a) un=0,n<0u,n≥0;un=0,n<0u,n≥0;
- (b) un=0,n≤0n,n>0.un=0,n≤0n,n>0.
Interpret your findings.
Evaluate the simple moving average xn=∑k=0N-11Nun-kxn=∑k=0N-11Nun-k when
u
n
u
n
is the sequence
u
n
=
0
,
n
<
0
a
n
,
n
≥
0
.
u
n
=
0
,
n
<
0
a
n
,
n
≥
0
.
(3)
Interpret your result.
When the weights
w
n
w
n
equal w0anw0an for n=0,1,...,N-1n=0,1,...,N-1, then the moving average
x
n
x
n
takes the form
xn=w0∑k=0N-1akun-kxn=w0∑k=0N-1akun-k.
When a<1a<1, then un is weighted more heavily than un-(N-1);un-(N-1); when a>1a>1,
un-(N-1)un-(N-1) is weighted more heavily than un ; when a=1,una=1,un is weighted the
same as un-(N-1).un-(N-1).
Evaluate
w
0
w
0
so that the exponential weighting sequence wn=wn=w0an(n=0,1,...,N-1)w0an(n=0,1,...,N-1) is a valid window (i.e., ∑n=0N-1wn=1∑n=0N-1wn=1).
Compute the moving average xn=∑k=0N-1w0akun-kxn=∑k=0N-1w0akun-k when the input sequence
u
n
u
n
is
u
n
=
b
n
,
n
≥
0
0
,
n
<
0
.
u
n
=
b
n
,
n
≥
0
0
,
n
<
0
.
(4)
What happens when b=ab=a? Can you explain this?
"Reviewer's Comments: 'I recommend this book as a "required primary textbook." This text attempts to lower the barriers for students that take courses such as Principles of Electrical Engineering, […]"