1 / 12

Moving Average Filters

Moving Average Filters. Rejean Lau, M.Eng. Noise Reduction vs. Step Response. The moving average filter is optimal for a common problem: reducing random white noise while keeping the sharpest step response.

val
Download Presentation

Moving Average Filters

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Moving Average Filters Rejean Lau, M.Eng

  2. Noise Reduction vs. Step Response • The moving average filter is optimal for a common problem: reducing random white noise while keeping the sharpest step response Of all the possible linear filters that could be used, the moving average produces the lowest noise for a given edge sharpness Q. Lowest noise as measured by what? A. Standard is to use the SNR

  3. Implementation by convolution Asymmetrical averaging Symmetrical averaging

  4. Implementation by Convolution • Moving average filter is a convolution of the input signal with a rectangular pulse with an area of 1 • The rectangular pulse is also known as the “filter kernel”, where kernel is the specified function in the integrand Eg. 5 point filter has the filter kernel: … 0,0,1/5,1/5,1/5,1/5,1/5,0,0 1/5 y[n] = X[n] X n n+1 n+2 n+3 n+4

  5. Implementation by Convolution

  6. Understanding the Moving Average Filter • Assume we fix the edge sharpness by specifying that there are 11 points in the rise of the step response • Therefore requires a filter kernel having 11 points Q. How do we choose the 11 values in the filter kernel to minimize the noise on the output signal? A. Since the noise we are trying to reduce is random, none of the input points is special; each is just as noisy as its neighbour. Therefore, it is useless to give preferential treatment to any one of the input points by assigning it a larger coefficient in the filter kernel. The lowest noise is obtained when all input samples are treated equally – therefore use a kernel with a constant plateau – the moving average filter.

  7. Frequency Response of the Moving Average Filter • Mathematically described by the Fourier transform of the rectangular pulse The frequency response has slow roll-off and poor stopband attenuation but we don’t care, because we only want to use the moving average filter as a smoothing filter in time domain

  8. Recursive Implementation • Imagine passing an input signal, x[ ], through a seven point moving average filter to form an output signal y[ ] • If y[50] has already been calculated, y[51] can be easily calculated • After the first point is calculated, all other points can be found with a single addition and subtraction per point • y[51] from y[50] • y[52] from y[51] • y[53] from y[52] … and so on

  9. Recursive Implementation The above observations can be generalized … • The equation is recursive because two sources of data are used to calculate • the output: points from the input and previously calculated points from the • output

  10. Recursive Performance • The recursive algorithm is faster than convolution filters for several reasons • There are only two computations per point, regardless of the length of the filter kernel • Addition and subtraction are the only mathematical operations needed, while convolution required multiplication • A very simple indexing scheme to calculate terms

  11. Performance and Precision • The performance can also be incredibly fast if we limit the input to integer values only *depending on the hardware used, integers can be more than an order of magnitude fast than floating point • Integer values as inputs results in absolute precise values, whereas the round-off error from floating point arithmetic can create a drifting offset • The round-off error can accumulate from one value to the next, if a large (precise) enough buffer is not used

  12. Implementation • Notes: • Uses a double precision accumulator to prevent round-off drift

More Related