Accelerating the pace of engineering and science

Documentation

Example Case for Multirate/Multistage Filters

Example Overview

This example shows the efficiency gains that are possible when using multirate and multistage filters for certain applications. In this case a distinct advantage is achieved over regular linear-phase equiripple design when a narrow transition-band width is required. A more detailed treatment of the key points made here can be found in the example entitled Efficient Narrow Transition-Band FIR Filter DesignEfficient Narrow Transition-Band FIR Filter Design.

Single-Rate/Single-Stage Equiripple Design

Consider the following design specifications for a lowpass filter (where the ripples are given in linear units):

Fpass = 0.13;   % Passband edge
Fstop = 0.14;   % Stopband edge
Rpass = 0.001;  % Passband ripple, 0.0174 dB peak to peak
Rstop = 0.0005; % Stopband ripple, 66.0206 dB minimum attenuation

Hf = fdesign.lowpass(Fpass,Fstop,Rpass,Rstop,'linear');

A regular linear-phase equiripple design using these specifications can be designed by evaluating the following:

Hd = design(Hf,'equiripple');

When you determine the cost of this design, you can see that 695 multipliers are required.

cost(Hd)


Reduce Computational Cost Using Mulitrate/Multistage Design

The number of multipliers required by a filter using a single state, single rate equiripple design is 694. This number can be reduced using multirate/multistage techniques. In any single-rate design, the number of multiplications required by each input sample is equal to the number of non-zero multipliers in the implementation. However, by using a multirate/multistage design, decimation and interpolation can be combined to lessen the computation required. For decimators, the average number of multiplications required per input sample is given by the number of multipliers divided by the decimation factor.

Hd_multi = design(Hf,'multistage');


You can then view the cost of the filter created using this design step, and you can see that a significant cost advantage has been achieved.

cost(Hd_multi)


Compare the Responses

You can compare the responses of the equiripple design and this multirate/multistage design using fvtool:

hfvt = fvtool(Hd,Hd_multi);
legend(hfvt,'Equiripple design', 'Multirate/multistage design')

Notice that the stopband attenuation for the multistage design is about twice that of the other designs. This is because the decimators must attenuate out-of-band components by 66 dB in order to avoid aliasing that would violate the specifications. Similarly, the interpolators must attenuate images by 66 dB. You can also see that the passband gain for this design is no longer 0 dB, because each interpolator has a nominal gain (in linear units) equal to its interpolation factor, and the total interpolation factor for the three interpolators is 6.

Further Performance Comparison

You can check the performance of the multirate/multistage design by plotting the power spectral densities of the input and the various outputs, and you can see that the sinusoid at $0.4\pi$ is attenuated comparably by both the equiripple design and the multirate/multistage design.

n       = 0:1799;
x       = sin(0.1*pi*n') + 2*sin(0.15*pi*n');
y       = filter(Hd,x);
y_multi = filter(Hd_multi,x);
[Pxx,w]   = periodogram(x);
Pyy       = periodogram(y);
Pyy_multi = periodogram(y_multi);
plot(w/pi,10*log10([Pxx,Pyy,Pyy_multi]));
grid on