Design and Implement a Filter
Design a digital lowpass filter using the Digital Filter Design block and incorporate the block into your model to simulate the presence of low frequency noise.
You can design lowpass, highpass, bandpass, and bandstop filters using either the Digital Filter Design block or the Filter Realization Wizard. These blocks are capable of calculating filter coefficients for various filter structures. This topic uses the Digital Filter Design block to convert white noise to low frequency noise so you can simulate its effect on your system.
As a practical application, suppose a pilot is speaking into a microphone within the cockpit of an airplane. The noise of the wind passing over the fuselage is also reaching the microphone. A sensor is measuring the noise of the wind on the outside of the plane. You want to estimate the wind noise inside the cockpit and subtract it from the input to the microphone so that only the pilot's voice is transmitted.
In the first section of this topic, you learn how to model the low frequency noise that is reaching the microphone. In the second section of the topic, you learn how to remove this noise so that only the pilot's voice is heard.
Design a Digital Filter in Simulink
In this section, you use a Digital Filter Design block to create low frequency noise, which models the wind noise inside the cockpit.
ex_gstut3 model. This model contains a Scope block that displays the original sine wave and the sine wave with white noise added.
Open the DSP System Toolbox™ library by typing
dsplib at the MATLAB® command prompt.
Convert white noise to low frequency noise by introducing a Digital Filter Design block into your model. In the airplane scenario, the air passing over the fuselage creates white noise that is measured by a sensor. The Random Source block models this noise. The fuselage of the airplane converts this white noise to low frequency noise, a type of colored noise, which is heard inside the cockpit. This noise contains only certain frequencies and is more difficult to eliminate. In this example, you model the low frequency noise using a Digital Filter Design block. This block uses the functionality of the Filter Design and Analysis Tool (FDATool) to design a filter.
Double-click the Filtering library, and then double-click the Filter Implementations sublibrary. Click-and-drag the Digital Filter Design block into your model.
Set the Digital Filter Design block parameters to design a lowpass filter and create low frequency noise. Open the block parameters dialog box by double-clicking the block. Set the parameters as follows:
Response Type =
Design Method = FIR. From the list, choose
Filter Order = Specify order and enter 31.
Scale Passband is cleared.
Normalized (0 to 1)
wc = 0.5
Based on these parameters, the Digital Filter Design block designs a lowpass FIR filter with 32 coefficients and a cutoff frequency of 0.5. The block multiplies the time-domain response of your filter by a 32 sample Hamming window.
Click Design Filter at the bottom center of the dialog box to view the magnitude response of your filter in the Magnitude Response pane. The Digital Filter Design dialog box should now look similar to the following figure.
You have now designed a digital lowpass filter using the Digital Filter Design block.
You can experiment with the Digital Filter Design block in order to design a filter of your own. For more information on the block functionality, see the Digital Filter Design block reference page.
Add a Digital Filter to Your Model
In this section, you add the lowpass filter you designed in Design a Digital Filter in Simulink to your block diagram. Use this filter, which converts white noise to colored noise, to simulate the low frequency wind noise inside the cockpit:
If the model you created in Design a Digital Filter in Simulink is not open on your desktop, open
ex_gstut4 which is an equivalent model.
Incorporate the Digital Filter Design block into your block diagram by placing it between the Random Source block and the Sum block.
Run your model and view the results in the Scope window. This window shows the original input signal and the signal with low frequency noise added to it.
You have now built a digital filter and used it to model the presence of colored noise in your signal. This is analogous to modeling the low frequency noise reaching the microphone in the cockpit of the aircraft. Now that you have added noise to your system, you can experiment with methods to eliminate it.