# Design Finite Impulse Response Digital Filters

Finite-impulse-response (FIR) digital filters enable many modern communications systems. Last month, this four-part article series opened with a review of key filter specifications and how tradeoffs impact final performance and examined several examples of optimal FIR designs, including filters with linear and nonlinear phase responses, and how the MATLAB mathematical software can be used to design such filters. This month, the second part of the series will further the investigation of optimal equiripple FIR filters and introduce some advanced design algorithms for interpolated FIR filters.

Last month, optimal equiripple designs were shown to outperform Kaiser-window designs for the same order and transition width. The differences between these approaches are even more dramatic when the passband ripple and stopband ripple specifications are different, since truncated-and-windowed impulse response methods always give a result with approximately the same passband and stopband peak ripple. Stringent peak-ripple constraints are often satisfied in excess of all other ripple constraints, and often at the expense of unnecessarily large filter order.

As an example, consider an equiripple design in which both the peak ripples and the transition width are fixed. As shown in Fig. 2, the order of the filter will be dictated by the peak-ripple and transition-width requirements. Using the second set of example specifications, with a cutoff frequency of 0.375π rad/sample, transition width of 0.15π rad/sample, maximum passband ripple of 0.008, and maximum stopband ripple of 0.0009, the "gremez" function can be used to design this filter

b = gremez('minorder',,...

,);

resulting in a 37th-order filter (38 taps). By comparison, a Kaiser-window design requires a 50th-order filter (51 taps) to meet the same specifications. Figure 11 shows the passband details, revealing that the Kaiser-window design significantly over-satisfies the requirements.

The approach used to design minimum-phase filters with fixed filter order and fixed transition width can be used to design minimum-phase filters with fixed transition width and peak passband/stopband ripple. Rather than obtaining smaller ripples, the benefit is meeting the same transition width and peak passband/stopband ripples with a reduced filter order.

For example, consider a third set of example specifications: a cutoff frequency of 0.13π rad/sample, transition width of 0.02π rad/sample, maximum passband ripple of 0.01, and maximum stopband ripple of 0.001. The minimum order needed to meet such specifications with a linear-phase FIR filter (an optimal equiripple design) is 262. If the linear-phase constraint is relaxed, however, the "gremez" function can be used to design a minimum-phase FIR filter that meets the specifications set with 216th order:

bgm = gremez('minorder', ,...

,,'minphase');

Examples so far have detailed equiripple designs with fixed transition width and fixed order and designs with fixed transition width and fixed peak-ripple values. MATLAB's Filter Design Toolbox also provides algorithms for designs with fixed peak-ripple values and fixed filter order.^{6} This gives maximum flexibility in utilizing the degrees of freedom available to design an FIR filter.

Compared to Kaiser-window designs, fixing the transition width and filter-order results in an optimal equiripple design with smaller peak ripple values, while fixing the transition width and peak ripple values results in a filter with less number of taps. Fixing the filter order and the peak ripple values should result in a smaller transition width, which can be verified by using the firceqrip function:

bc = firceqrip(50, 0.375, );

Figure 12 offers a comparison of this design with a Kaiser-window filter. For the new filter, the transition width has been reduced from 0.15π to approximately 0.11π.

If linear phase is not a requirement, a minimum-phase filter can be designed that is superior in some sense to a comparable linear-phase filter. For the same filter order and peak-ripple value, a minimum-phase design results in a smaller transition width than a linear-phase design. For example, compared to the 50th-order linear-phase design "bc" above, the "bcm" design that follows has a noticeably smaller transition width:

bcm = firceqrip(50, 0.375, , 'min');

Further equiripple design options are available in the Filter Design Toolbox. Notable examples include the constrained-band design, where the filter order can be fixed along with the peak ripple and the beginning/end of a given band (passband or stopband), and the sloped stopband design, where the stopband is no longer equiripple, but rather has a predetermined slope.

When designing lowpass filters for decimation, it is sometimes necessary to guarantee that the filter stopband begins at a specific frequency value and that the filter provides a given minimum stopband attenuation. If the filter order is fixed, for example when using specialized hardware, there are two alternatives available in the Filter Design Toolbox for optimal equiripple designs. One possibility is to fix the transition width, the other is to fix the passband ripple.

As an example, using the second set of design specifications calls for a stopband that extends from 0.45π to π and provides minimum stopband attenuation of approximately 60 dB. Assuming that an example filter order of 40 (41 taps) is available, the "fircequip" function can be used to design this filter if the passband ripple is also fixed to 0.008. The function will yield a filter with the smallest possible transition width for any linear-phase FIR filter of that order that meets the given specifications:

bc = firceqrip(40, 0.45, ,'stopedge');

### Page Title

In contrast, if the transition width is fixed, the "gremez" function can be used to design the filter, yielding a filter with the smallest possible passband ripple for any linear-phase FIR filter of that order that meets the second set of specifications:

bg = gremez(40, , ,...

, {'w', 'c'});

Figure 13 compares the passbands of the two filters. Both designs meet the specifications since the order (40) is larger than the minimum order required (37) for an equiripple linear-phase filter to meet the specifications. The filters differ in how they "use" the extra number of taps to better approximate the ideal lowpass filter.

An alternative to using least-squares designs is to design optimal equiripple filters and allowing for a slope in the stopband of the filter. This has the advantage (over least-squares designs) that the passband can remain equiripple, thus minimizing the input signal fluctuations in that region. While it is possible to achieve sloped stopbands with "remez" or "gremez" methods by using the weights, the "firceqrip" function provides the best control and easiest way to do this (at the expense of not having full control over the transition width). With the "firceqrip" function, it is possible to specify the desired slope (in dB per frequency unit) for the stopband.

For example, the design

bf = firceqrip(42, 0.4346, , ,...

'slope', 40, 'stopedge');

results in stopband energy of approximately 3.9771e-005, which is not much larger than the least-squares design of Part 1 (Eq. C), while having a smaller transition width (or peak passband ripple, depending upon the interpretation). Figure 14 shows the passband details (in dB) of the least-squares sloped equiripple designs, while Fig. 15 offers the stopband details (also in dB).

Interpolated FIR Filters

For any given FIR design algorithm, if the peak ripple specifications remain the same, the filter order required to meet a given specifications set is inversely proportional to the transition width allowed. When the transition width is small, such as in the third set of specifications, the required filter order may be quite large. This is one of the primary disadvantages of FIR filters. It has already been shown that relaxing the linear-phase requirement results in a significant savings in the number of filter coefficients.

The so-called *interpolated* FIR (IFIR) approach^{9-11} yields linear-phase FIR filters that can meet the given specifications with a reduced number of multipliers. Quite simply, since the length of the filter grows as the transition width shrinks, the filter is not being designed for a given (small) transition width. Rather, the filter is designed for a multiple L of the transition width. The filter will have a significantly smaller length than a direct design for the original (small) transition width. The impulse response of this smaller filter is then upsampled by a factor equal to the multiple of L. Upsampling will cause the designed filter to compress, meeting the original specifications without introducing extra multipliers (it only introduces zeros, resulting in a larger delay). The penalty for this action is the appearance of spectral replicas of the desired filter response within the Nyquist interval. These replicas must be removed by a second filter (called the interpolation filter or image suppressor filter) that is cascaded with the original to obtain the desired overall response. Although this extra filter introduces additional multipliers, it is possible in many cases to still have overall computational savings relative to conventional designs (Fig. 16).

As an example, consider a design with upsampling factor of 3 (Fig. 17). The "relaxed" design is approximately of one third the length of the desired design, if the latter were to be designed directly. The upsampled design has the same transition width as the desired design. All that is left is to remove the spectral replica introduced by upsampling, which is the function of the image suppressor filter.

To show the savings in computation, consider the third set of design specifications. The number of multipliers required for a single linear-phase design was 263. An IFIR design can attain the same specifications with 127 multipliers when using an upsampling factor of 6:

= ifir(6, 'low', , );

Figure 18 shows the response of the upsampled filter and the image suppressor filter, while Fig. 19 shows the overall (composite) response compared to a single linear-phase equiripple design.

### Page Title

A drawback in the IFIR design is that the passband ripples of the two filters are combined in a disorderly fashion. In the worst-case scenario, they can add up, requiring the design to ensure that the sum of the two peak passband ripples does not exceed the original set of specifications. A closeup of the passband of the previous IFIR example filter (Fig. 20) shows the chaotic behavior of the ripple (although still meeting the specification). Further optimized designs,^{2,12} attain a much cleaner passband behavior by jointly optimizing the design of the two filters. This results in a filter that can meet the specifications set with an even further reduction in the number of multipliers. The savings are especially significant for the image-suppressor filter, which is greatly simplified by this joint optimization.

Using joint optimization, the third set of design specifications can be met with only 74 multipliers and an upsampling factor of 6. The filter can be designed using the 'adv' flag in the "ifir" function. The manner in which the two filters work together is best described by looking at their magnitude responses (Fig. 21). By precompensating for a severe "droop" in the image suppressor filter, a flat passband can be achieved with dramatic savings in the number of multipliers required for the image suppressor filter. Out of the 74 multipliers required, 29 are for the image suppressor filter and 45 for the upsampled filter. By contrast, in the previous IFIR design, 78 of the 127 multipliers correspond to the image suppressor filter, while 49 correspond to the upsampled filter. The passband details of the overall design show a well-behaved equiripple response, hinting at a much better optimized design (Fig. 22).

When designing an IFIR filter, the upsampling factor L must be such that the (normalized) stopband-edge frequency ω_{s} satisfies the condition Lω_{s} < π. This implies that the bandwidth of the output signal would be reduced by a factor of L. From a computational perspective, it is convenient to reduce the sampling frequency of the filtered signal, since at that point the Nyquist criterion is unnecessarily oversatisfied. Subsequent processing of the filtered signal without reducing its sampling rate would results in unnecessary (and expensive) redundant processing of information. The filtered signal should be downsampled by a factor of L to match the reduction in bandwidth due to filtering. If I(z) is the image suppressor filter and U(z^{L}) is the upsampled filter, the cascade of the filters can be shown by Fig. 23. Using the Noble identities, it is possible to "commute" the downsampler and U(z^{L}) to obtain the implementation of Fig. 24. The combination of I(z) and the downsampler form a decimator, which can be implemented efficiently in polyphase form.

Next month, this four-part FIR filter design series will continue with an examination of interpolation filter design, notably for band-limited interpolation filters. The discussion will include details on designing Nyquist FIR filters, halfband FIR filters, and two-channel FIR filter banks.

REFERENCES

9. Y. Neuvo, C.-Y. Dong, and S.K. Mitra, "Interpolated finite impulse response filters," *IEEE Transactions on Acoustic Speech and Signal Processing*, Vol. ASSP-32, June 1984, pp. 563-570.

10. P.P. Vaidyanathan, *Multirate Systems and Filter Banks*, Prentice-Hall Signal Processing Series, Prentice-Hall, Englewood Cliffs, NJ, 1993.

11. R. Lyons, "Interpolated narrowband lowpass FIR filters," *IEEE Signal Processing Magazine*, January 2003, pp. 50-57.

12. T. Saramaki, Y. Neuvo, and S.K. Mitra, "Design of computationally efficient interpolated FIR filters," *IEEE Transactions on Circuits and Systems*, Vol. 35, No. 1, January 1988, pp. 70-88.