Student Center
Problem: Develop a moving average filter
Discrete-time systems if modeled well can take a given input and process it to generate a desired set of output sequences. A good example of a discrete-time system is something called a moving average system, also known as a FIR averaging filter. The goal of a moving average system is to smooth irregularities and random variations in a data set or signal. Figure 1 shows a situation where a moving average filter can help remove noise (agn[n]) that has been added to the desired signal (sig[n]).
![]() |
| Figure 1: Corrupted Signal through a Moving Average Filter. |
A moving average filter can be modeled mathematically as shown in Equation (1). Looking at Equation (1), you can tell that the upper bound M in the summation can be any number of values. However, the value you select determines the order of the filter, which is the number of input samples you want your filter to take in for averaging.

Design Criteria: Develop a moving average filter that can remove random variations from a simple discrete sine wave signal that contains random uniform noise.
Objective: Using MATLAB, create and plot the discrete sine wave, the Gaussian noise generator, and the moving average filter. Use the filter to remove the corrupted sine wave and plot this result with the noise corrupted one and compare. Also use the Filter Visualization Tool (FVTool) to analyze the characteristics of your moving average filter. FVTool computes the magnitude response of the digital filter defined with numerator, b and denominator, a. It can display the phase response, group delay, impulse response, step response, pole-zero plot, and coefficients of your the filter.
Given: M = 12 (input samples), n = 101 (signal length), and A = 0.25 (random noise amplitude).
Store

