The Simple Moving Average Filter
This page describes the simple moving average filter. This page is part of the section on
Filtering that is part of
A Guide to Fault Detection and Diagnosis..
The simple moving average filter averages recent values of the filter input for a given number of inputs. Like the exponential filter, it is a low-pass filter, intended to pass low frequencies and attenuate higher frequencies. This is the most common example of the “moving average” (MA) category of filters, also called finite impulse response (FIR) filters. Each recent input is multiplied by a coefficient for all linear MA filters, and the coefficients are all the same for this simple moving average. The sum of the coefficients is 1.0, so that the output eventually matches the input when the input doesn’t change. Its output just depends on recent inputs, unlike the exponential filter that also reuses its previous output. The only parameter is the number of points in the average - the “window size”.
Moving average step response
Like any MA filter, it completes a step response in a finite time depending on window size. The step response is a straight line until the response is complete. (Click the plot for a full-sized image)
This simple moving average example above was based on 9 points. Under modest assumptions, it is providing the optimal (smoothing) estimate for a value at the midpoint of the time interval, in this case, 4.5 sample intervals in the past.
Copyright 2010 - 2020, Greg Stanley
Return to Filtering Next: Least Squares Filter
Return to A Guide to Fault Detection and Diagnosis