DSP Blockset | ![]() ![]() |
Example: Least Squares Multiband Filter. In the model below, the Sine Wave block generates four sinusoids, at 100, 200, 300, and 400 Hz, each with a frame size of 128 samples. The sinusoids are summed point-by-point, and the resulting signal is passed through a multiband FIR filter to attenuate the sinusoids at 200 and 400 Hz. Both signals are displayed on the scope.
To build the model, make the following parameter settings:
10
[100 200 300 400]
0
0.001
The Sample time setting represents a sample rate of 1 kHz.
16
[0 125 175 225 275 325 375 500]/500
[1 1 0 0 1 1 0 0]
[1 1 1 1]
2
inf
, and start the simulation by selecting Start from the Simulation menu. Use the default setting in the Spectrum Scope block. As the simulation begins running, right-click in the plot area of the scope, and select Autoscale from the pop-up menu. You can also change the styles and colors of the plotted lines by selecting either CH 1 or CH 2 from the right-click pop-up menu.
The Band edge frequency vector and Gains at these frequencies vectors define the desired magnitude response below.
Note that the values in the Band edge frequency vector are divided by half the sample frequency (in this case is 500 Hz) so that the maximum value is 1
, as required.
The scope window displays both the original signal and the filtered result, which shows the expected attenuation of the 200 and 400 Hz components. Stop the simulation at any time by selecting Stop from the Simulation menu. Try different band configurations to attenuate the peaks at different frequencies.
![]() | Weight Parameters | Filter Structures | ![]() |