| DSP Blockset |
 |
Filtering High-Frequency Noise
In this topic, you create a model that simulates high-frequency noise being output by a highpass filter that is excited by a uniform random signal. This high frequency noise is added to a sine wave. This noisy sine wave is fed through a lowpass filter that filters out the high-frequency noise.
Note
You can open many of the example models in the online version of this document by clicking links or by typing specified commands at the MATLAB command line. The links for opening example models do not work in Web browsers; they work only in the MATLAB Help browser, which you can open by typing doc at the MATLAB command line.
|
- Open the model that contains the highpass and lowpass filter described in Creating a Lowpass Filter and Creating a Highpass Filter.
- Click and drag the blocks in this table into your model file.
- Set the parameters for the rest of the blocks as indicated in the following table. Leave the parameters not listed in the table at their default settings.
Parameter Settings for the Other Blocks
Block
|
Parameter Setting
|
Matrix Concatenation
|
- Number of inputs --
3
- Concatenation method --
Horizontal
|
Random Source
|
- Source type --
Uniform
- Minimum --
0
- Maximum --
4
- Sample mode --
Discrete
- Sample time --
1/1000
- Samples per frame --
50
|
Sine Wave
|
- Frequency (Hz) --
75
- Sample time --
1/1000
- Samples per frame --
50
|
Sum
|
- Icon shape --
rectangular
- List of signs --
++
|
Vector Scope
|
Scope properties:
- Input domain --
Time
- Time display span (number of frames) --
1
|
- Connect the blocks as shown in the following figure. You might need to resize some of the blocks to make your model look like the figure.
- From the Simulation menu, choose Simulation parameters.
- Set the Simulation parameters as indicated in the following figure.
- Click OK.
- In the model window, from the Simulation menu, choose Start.
- The model simulation begins and the scope displays the three input signals. When you finish observing the running model, from the Simulation menu, choose Stop.
- Double-click the Vector Scope block and select the Show display properties check box. Select the Channel legend check box and click OK. Next time you run the simulation, a legend appears in the Vector Scope window.
- You can also set the color, style, and marker of each channel.
- In the Vector Scope window, from the Channels menu, point to Ch 1 and set the Style to -, Marker to None, and Color to Black.
- Point to Ch 2 and set the Style to -, Marker to Diamond, and Color to Red.
Point to Ch 3 and set the Style to None, Marker to *, and Color to Blue.

- Rerun the simulation and compare the original sine wave, noisy sine wave, and filtered noisy sine wave in the Vector Scope display.
- You can see that the lowpass filter filters out the high-frequency noise in the noisy sine wave.
In this example, Digital Filter Design blocks were used to design and implement lowpass and highpass filters. For information on another block capable of designing and implementing filters, see Filter Realization Wizard.
To learn how to save your filter designs, see the Saving and Opening Filter Design Sessions section of the Signal Processing Toolbox documentation. To learn how to import and export your filter designs, see the Importing and Exporting Quantized Filters section of the Filter Design Toolbox documentation.
| Creating a Highpass Filter | | Filter Realization Wizard |  |
Learn more about the latest releases of MathWorks products:
|