<< Chapter < Page Chapter >> Page >
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 ) .

The most current input, u n , is weighted by w 0 ; the next most current input, u n - 1 , is weighted by w 1 ; and so on. This weighting is illustrated in Figure 1 . The sequence of weights, w 0 through w N - 1 , is called a “window,” a “weighting sequence,” or a “filter.” In the example illustrated in Figure 6.8, the currentvalue u n is weighted more heavily than the least current value. This is typical (but not essential) because we usually want x n to reflect more of the recent past than the distant past.

This is a graph consisting of two curved lines that are horizontal in nature and several vertical lines which arise at from the x axis and end when they reach the curved line. The first curved line begins with an initial positive slope, but after reach the second vertical line takes an extremely negative slope and falls below the x axis. At about the seventh vertical line, the slop again turns positive and rise quickly at first and then plateaus. The other horizontal line begins around the third horizontal line and has a positive slope which gets more and more positive to it almost vertical by the time it ends. The intersection of the first horizontal and the third horizontal line is labeled u_n-(n-1). The intersection of the second horizontal line and the third vertical line is labeled w_N-1. The third line appears to be labeled below the x axis as N-1. The intersections of the final three vertical lines and the second horizontal line are labeled w_2, w_1, and w_0 from left to right.  The intersection of the second and third to last vertical lines and the first horizontal line are labeled U_n-1 and U_n respectively. The second and third from the left vertical line are labeled below the x axis as N-1 and n. The x axis line is labeled k. This is a graph consisting of two curved lines that are horizontal in nature and several vertical lines which arise at from the x axis and end when they reach the curved line. The first curved line begins with an initial positive slope, but after reach the second vertical line takes an extremely negative slope and falls below the x axis. At about the seventh vertical line, the slop again turns positive and rise quickly at first and then plateaus. The other horizontal line begins around the third horizontal line and has a positive slope which gets more and more positive to it almost vertical by the time it ends. The intersection of the first horizontal and the third horizontal line is labeled u_n-(n-1). The intersection of the second horizontal line and the third vertical line is labeled w_N-1. The third line appears to be labeled below the x axis as N-1. The intersections of the final three vertical lines and the second horizontal line are labeled w_2, w_1, and w_0 from left to right.  The intersection of the second and third to last vertical lines and the first horizontal line are labeled U_n-1 and U_n respectively. The second and third from the left vertical line are labeled below the x axis as N-1 and n. The x axis line is labeled k.
Moving Average

When the weights w 0 , w 1 , ... , w N - 1 are all equal to 1 N , then the moving average x n is a “simple moving average”:

x n = 1 N [ u n + u n - 1 + + u N - 1 ] .

This is the same as the simple average , but now the simple average moves along the sequence of inputs, averaging the N most current values.

When the weights w n equal w 0 a n for n = 0 , 1 , ... , N - 1 , then the moving average x n takes the form

x n = w 0 k = 0 N - 1 a k u n - k .

When a < 1 , then u n is weighted more heavily than u n - ( N - 1 ) ; when a > 1 , u n - ( N - 1 ) is weighted more heavily than u n ; when a = 1 , u n is weighted the same as u n - ( N - 1 ) .

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, A first course in electrical and computer engineering. OpenStax CNX. Sep 14, 2009 Download for free at http://cnx.org/content/col10685/1.2
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'A first course in electrical and computer engineering' conversation and receive update notifications?

Ask