CH15 - CHAPTER 15 Moving Average Filters The moving average...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
277 CHAPTER 15 EQUATION 15-1 Equation of the moving average filter. In this equation, is the input signal, is x [ ] y [ ] the output signal, and M is the number of points used in the moving average. This equation only uses points on one side of the output sample being calculated. y [ i ] 1 M j M 1 j 0 x [ i % j ] y [80] x [80] % x [81] % x [82] % x [83] % x [84] 5 Moving Average Filters The moving average is the most common filter in DSP, mainly because it is the easiest digital filter to understand and use. In spite of its simplicity, the moving average filter is optimal for a common task: reducing random noise while retaining a sharp step response. This makes it the premier filter for time domain encoded signals. However, the moving average is the worst filter for frequency domain encoded signals, with little ability to separate one band of frequencies from another. Relatives of the moving average filter include the Gaussian, Blackman, and multiple- pass moving average. These have slightly better performance in the frequency domain, at the expense of increased computation time. Implementation by Convolution As the name implies, the moving average filter operates by averaging a number of points from the input signal to produce each point in the output signal. In equation form, this is written: Where is the input signal, is the output signal, and M is the number x [ ] y [ ] of points in the average. For example, in a 5 point moving average filter, point 80 in the output signal is given by:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
The Scientist and Engineer's Guide to Digital Signal Processing 278 y [80] x [78] % x [79] % x [80] % x [81] % x [82] 5 100 'MOVING AVERAGE FILTER 110 'This program filters 5000 samples with a 101 point moving 120 'average filter, resulting in 4900 samples of filtered data. 130 ' 140 DIM X[4999] 'X[ ] holds the input signal 150 DIM Y[4999] 'Y[ ] holds the output signal 160 ' 170 GOSUB XXXX 'Mythical subroutine to load X[ ] 180 ' 190 FOR I% = 50 TO 4949 'Loop for each point in the output signal 200 Y[I%] = 0 'Zero, so it can be used as an accumulator 210 FOR J% = -50 TO 50 'Calculate the summation 220 Y[I%] = Y[I%] + X(I%+J%] 230 NEXT J% 240 Y[I%] = Y[I%]/101 'Complete the average by dividing 250 NEXT I% 260 ' 270 END TABLE 15-1 As an alternative, the group of points from the input signal can be chosen symmetrically around the output point: This corresponds to changing the summation in Eq. 15-1 from: , j 0 to M 1 to: . For instance, in a 10 point moving average j ( M 1)/2 to ( M 1)/2 filter, the index, j , can run from 0 to 11 (one side averaging) or -5 to 5 (symmetrical averaging). Symmetrical averaging requires that M be an odd number. Programming is slightly easier with the points on only one side; however, this produces a relative shift between the input and output signals. You should recognize that the moving average filter is a convolution using a very simple filter kernel. For example, a 5 point filter has the filter kernel: . That is, the moving average filter is a 0, 0, 1/5, 1/5, 1/5, 1/5, 1/5, 0, 0 convolution of the input signal with a rectangular pulse having an area of one . Table 15-1 shows a program to implement the moving average filter.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 08/27/2011.

Page1 / 8

CH15 - CHAPTER 15 Moving Average Filters The moving average...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online