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. In this section, you use 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 this chapter, you first learn how to model the low frequency noise that is reaching the microphone. Later, you learn how to remove this noise so that only the pilot's voice is heard.
In this topic, you use a Digital Filter Design block to create low frequency noise, which models the wind noise inside the cockpit:
Open the model by typing
at the MATLAB® command prompt. 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
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 and,
from the list, choose
Filter Order = Specify
order and enter
Scale Passband — Cleared
(0 to 1)
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. For more information on the Filter Design and Analysis Tool, see FDATool in the Signal Processing Toolbox™ documentation.
In this topic, 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, you can open an equivalent model by typing
at the MATLAB command prompt.
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.