Image

Design Finite Impulse Response Digital Filters

Jan. 1, 2004
Precise FIR digital filters can be designed with the help of a popular mathematical modeling program and an understanding of basic performance trade-offs.

Digital filters have enabled much of modern communications and the measurements that support them. While most high-frequency design engineers may be familiar with the use of the MATLAB mathematical modeling tool from The MathWorks (Natick, MA) for the design of advanced antennas, the software also features powerful algorithms and toolboxes for the design of finite-impulse-response (FIR) digital filters. This four-part article series on designing FIR digital filters with MATLAB will open with a review of key FIR filter specifications and examples of optimal linear- and nonlinear-phase FIR filter designs. Although many lowpass filters will be shown, the design techniques apply to other filter types as well.

An ideal lowpass filter passes all frequency components of a signal below a designated cutoff frequency, ωc, and rejects all frequency components of a signal above ωc, according to:

The impulse response of an ideal lowpass filter in Eq. 1 can be found from1:

Because the impulse response required to implement the ideal lowpass filter is infinitely long, it is not possible to design an ideal FIR lowpass filter. Finite-length approximations of the ideal impulse response lead to ripples in both the passband and the stopband, as well as a nonzero transition width between the passband and the stopband (Fig. 1).

Although it would be ideal to eliminate the transition width as well as the passband and stopband ripples, they are unavoidable deviations from the response of an ideal lowpass filter when using an FIR approximation. Practical FIR designs typically consist of filters meeting certain design specifications. For example, a practical FIR filter design has a given transition width and passband and stopband ripples set at some maximum value(s). The filter is also defined by its order, or equivalently, the length of the truncated impulse response.

The trade-offs among key filter specifications can be represented in the form of a triangle (Fig. 2). The triangle shows the degrees of freedom available when designating design specifications. Because the sum of the angles is fixed, values can only be selected for two of the specifications; the third will be dictated by the selection of the other two. As with the triangle, if one of the specifications is made larger or smaller, it will impact one or both of the other two specifications.

For example, consider the design of an FIR filter that meets the following specifications: a cutoff frequency of 0.4π rads/sample, a transition width of 0.06π rads/sample, and maximum passband and stopband ripple of 0.05 dB. The filter can easily be designed with the truncated-and-windowed impulse response algorithm implemented in the "firl" function within MATLAB's Filter Design Toolbox (or by using the "fdatool" graphical user interface) provided that a Kaiser-window filter design is used. Figure 3 shows the zero-phase response of a filter designed according to these specifications. Since the transition width and peak-ripple performance are fixed, the filter order has been determined by these other two parameters.

Examination at the stopband-edge frequency ωs = 0.43π shows that the peak passband/stopband ripples are within the allowable specifications. Usually, the specifications are exceeded because the order is rounded to the next integer greater than the actual value required.

While the truncated-and-windowed impulse response design algorithm is simple and reliable, it is not optimal. It yields designs that are generally inferior to those produced by algorithms employing optimization criteria; the nonoptimized designs will have greater order, greater transition width, or greater passband/stopband ripples than an optimized design. Since improved performance is usually desirable, the usefulness of more sophisticated algorithms (with optimization) is obvious.

Optimal designs are computed by minimizing some measure of the deviations between an ideal filter and a filter to be designed. The most common optimal FIR design algorithms are based on fixing the transition width and the order of the filter, and minimizing the ideal/practical deviations of the passband/stopband ripples. This deviation or error can be expressed mathematically as (ref. 2):

where:

Ha(ω) = the zero-phase response of the designed filter and

It is still necessary to define a measurement to determine "the size" of E(ω), the quantity to be minimized as a result of the optimization. The most often used measures are L(infinity)-norm (||E(w)||(infinity) minimum-maximum designs) and L2-norm (||E(w)||2 least-squares designs).

To allow for different peak ripples in the passband and stopband, a weighting function is usually introduced:

A filter with linear-phase response is desirable in many applications, notably image processing and data transmission. One of the desirable characteristics of FIR filters is that they can be designed very easily to have linear phase. It is well known3 that linear-phase FIR filters will have impulse responses that are either symmetric or antisymmetric. For these types of filters, the zero-phase response can be determined analytically,3 and the filter design problem becomes a well-behaved approximation theory problem.4 The approximation involves determining the best solution for a given function (the response of an ideal lowpass filter) by means of a polynomial (the FIR filter) of given order. The "best" solution is one that minimizes the differences for a given performance parameter between an ideal filter and the filter to be designed.

The "remez" function in MATLAB implements an algorithm developed in ref. 5 that computes a solution to the design problem for linear-phase filters in the L(infinity)-norm case. The design problem is essentially to find a filter that minimizes the maximum error between the ideal and the actual filters. This type of design leads to so-called equiripple filters, i.e., filters in which the peak deviations from the ideal response are all equal.

The software's "firls" function implements an algorithm to compute solution for linear-phase FIR filters in the L2-norm case. The design problem is to find a filter that minimizes the energy of the error between ideal and actual filters.

Page Title

Linear-phase equiripple filters are desirable because they have the smallest maximum deviation from the ideal filter when compared to all other linear-phase FIR filters of the same order. Equiripple filters are ideally suited for applications in which a specific tolerance must be met, such as when designing a filter with a given minimum stopband attenuation or a given maximum passband ripple.

For example, the earlier Kaiser-window design example was of 42nd order. With this same order, an equiripple filter (with fixed transition width) can be designed that is superior to the Kaiser-window design:

br = remez(42,, );

Figure 4 shows the superposition of the passband details for the filters designed with the Kaiser window and with the "remez" function, with the maximum deviation appearing smaller for the "remez" design. In fact, since the filter is designed to minimize the maximum ripple (minimax design), the optimization process guarantees that no other linear-phase FIR filter of the 42nd order will have a smaller peak ripple for the same transition width.

Equiripple designs may not be the best design approach to minimize the error between the ideal and the designed filter's passband and stopband energy. A least-squares design approach is preferable to reduce the energy of a signal as much as possible in a certain frequency band. For example, for the same transition width and filter order as the earlier equiripple filter, a least-squares FIR design can be computed from:

bls = firls (42, , );

The stopband energy for this case is:

where:

Ha(ejv) is the frequency response of the filter.

In this case, the stopband energy for the equiripple filter is approximately 1.7608e-004 while the stopband energy for the least-squares filter is 3.3106e-005. (As a reference, the stopband energy for the Kaiser-window design for this order and transition width is 6.1646e-005.) While the equiripple design has less peak error, it has more total error, measured in terms of its energy. The stopband details for both the equiripple design and the least-squares design are shown in Fig. 5.

An advantage of an FIR filter compared to an infinite-impulse-response (IIR) filter is the ability to attain exact linear phase in a straightforward manner. As mentioned previously, a linear-phase characteristic implies a symmetry or antisymmetry property for the filter coefficients. Nevertheless, the symmetry of the coefficients constrains the possible designs that can be attained. For a filter with N + 1 coefficients, only N/2 + 1 of these coefficients is freely assignable (assuming that N is even). The remaining N/2 coefficients are immediately determined by the linear-phase constraint.

This can be thought of as reducing the search space for an optimal solution. The idea is depicted in Fig. 6.7 Region A of the graph represents the set of all linear-phase FIR filters that meet a given set of specifications. This set contains both the optimal equiripple and the optimal least-squares filters mentioned so far. Region B represents the set of all FIR filters that meet a set of specifications, regardless of their phase characteristic, with Region A contained within Region B.

Without the linear-phase constraint (i.e., if the application at hand does not require a linear-phase characteristic), it is possible to design minimum-phase equiripple filters that are superior to optimal equiripple linear-phase designs based on a technique described in ref. 8. For example, the following minimum-phase design has both smaller peak passband ripple and smaller peak stopband ripple than the linear-phase equiripple design:

bm = gremez (42, , , , 'minphase')

It should be noted that this is not a totally unconstrained design. The minimum-phase requirement restricts the resulting filter to have all of its zeros on or inside the unit circle.2

Due to the requirement on the loci of the zeros, minimum-phase designs are not completely unconstrained. A general nonlinear-phase design algorithm is provided in the "firlpnorm" function. Consider the following specifications: a cutoff frequency of 0.375π rads/sample, a transition width of 0.15π rads/sample, maximum passband ripple of 0.008, and maximum stopband ripple of 0.0009. A 30th-order FIR equiripple filter (with nonlinear phase) can be designed to meet this set of specifications using the "firlpnorm" function:

blp = firlpnorm (30, , , , );

This 30th-order design is in sharp contrast to a linear-phase filter, which would require a 37th-order architecture. By comparison, a minimum-phase equiripple filter designed using the "gremez" function would also require a 30th-order filter to meet the specifications.

The fact that two different nonlinear-phase filters of the same order meet the same specifications illustrates the difficulty associated with nonlinear-phase designs in general. There is no longer a unique optimal solution to a given design problem. Figure 7 shows the virtually identical magnitude responses. In contrast, Fig. 8 shows the different impulse responses.

Page Title

The "firlpnorm" function also provides the ability to select a different norm for the optimization. While the default optimization is for the L(infinity)-norm design, any design between (and including) L2-norm and L(infinity)-norm is possible.

By the arguments given above, it is possible to attain a superior design using the "firlpnorm" function instead of the "firls" function for the same filter order, provided linear phase is not a requirement. For example,

b = firlpnorm (40, , {0 .4 .45 1>, , , );

b2 = firls (40, , , );

yields a smaller transition width and a larger stopband attenuation for the nonlinear-phase case (with approximately the same peak passband ripple). The stopband details are shown in Fig. 9.

Because it is possible to choose the Lp-norm approach with which to optimize, the "firlpnorm" function is very flexible and allows for the designer to reach a compromise between equiripple and least-squares designs (Fig. 10).

Because of the symmetry in the coefficients, some practical implementations will allow for a linear-phase response using roughly one-half the number of multipliers. This is particularly true with field-programmable gate arrays (FPGAs) and specialized hardware. The end result is that it may be possible to stick to a linear-phase design and achieve a more efficient implementation than comparable nonlinear-phase designs.

Next month, this four-part FIR filter design series will continue with an examination of optimal equiripple FIR filter designs, notably those in which both the peak ripples and the transition width are fixed. Part two will also explore the use of advanced filter design algorithms for implemented interpolated FIR filters.

REFERENCES

  1. S.J. Orfanidis, Introduction to Signal Processing, Prentice-Hall, Upper Saddle River, NJ, 1996.
  2. T. Saramaki, "Finite impulse response filter design," in Handbook for Digital Signal Processing, S.K. Mitra and J.F. Kaiser, Eds., Wiley, New York, 1993, Chap. 4.
  3. L.R. Rabiner and B. Gold, Theory and Application of Digital Signal Processing, Prentice-Hall, Englewood Cliffs, NJ, 1975.
  4. E.W. Cheney, Introduction to Approximation Theory, American Mathematical Society, Providence, RI, 1998.
  5. J.H. McClellan, T.W. Parks, and L.R. Rabiner, "A computer program for designing optimum FIR linear phase digital filters," IEEE Transactions on Audio Electroacoustics, Vol. AU21, 1973, pp. 506-526.
  6. I.W. Selesnick and C.S. Burrus, "Exchange algorithms that complement the Parks-McClellan algorithm for linear-phase FIR filter design," IEEE Transactions on Circuits and Systems II, Vol. 44, No. 2, February 1997, pp. 137-142.
  7. Private communication, suggestions made by R.A. Vargas.
  8. O. Hermann and H.W. Schussler, "Design of nonrecursive digital filters with minimum phase," Electronic Letters, Vol. 6, 1970, pp. 329-330.

Sponsored Recommendations

Wideband Peak & Average Power Sensor with 80 Msps Sample Rate

Aug. 16, 2024
Mini-Circuits’ PWR-18PWHS-RC power sensor operates from 0.05 to 18 GHz at a sample rate of 80 Msps and with an industry-leading minimum measurement range of -40 dBm in peak mode...

Turnkey Solid State Energy Source

Aug. 16, 2024
Featuring 59 dB of gain and output power from 2 to 750W, the RFS-G90G93750X+ is a robust, turnkey RF energy source for ISM applications in the 915 MHz band. This design incorporates...

90 GHz Coax. Adapters for Your High-Frequency Connections

Aug. 16, 2024
Mini-Circuits’ expanded line of coaxial adapters now includes the 10x-135x series of 1.0 mm to 1.35 mm models with all combinations of connector genders. Ultra-wideband performance...

Ultra-Low Phase Noise MMIC Amplifier, 6 to 18 GHz

July 12, 2024
Mini-Circuits’ LVA-6183PN+ is a wideband, ultra-low phase noise MMIC amplifier perfect for use with low noise signal sources and in sensitive transceiver chains. This model operates...