Signal Processing Toolbox Previous page   Next Page

Multiband FIR Filter Design with Transition Bands

The firls and firpm functions provide a more general means of specifying the ideal desired filter than the fir1 and fir2 functions. These functions design Hilbert transformers, differentiators, and other filters with odd symmetric coefficients (type III and type IV linear phase). They also let you include transition or "don't care" regions in which the error is not minimized, and perform band dependent weighting of the minimization.

The firls function is an extension of the fir1 and fir2 functions in that it minimizes the integral of the square of the error between the desired frequency response and the actual frequency response.

The firpm function implements the Parks-McClellan algorithm, which uses the Remez exchange algorithm and Chebyshev approximation theory to design filters with optimal fits between the desired and actual frequency responses. The filters are optimal in the sense that they minimize the maximum error between the desired frequency response and the actual frequency response; they are sometimes called minimax filters. Filters designed in this way exhibit an equiripple behavior in their frequency response, and hence are also known as equiripple filters. The Parks-McClellan FIR filter design algorithm is perhaps the most popular and widely used FIR filter design methodology.

The syntax for firls and firpm is the same; the only difference is their minimization schemes. The next example shows how filters designed with firls and firpm reflect these different schemes.

Basic Configurations

The default mode of operation of firls and firpm is to design type I or type II linear phase filters, depending on whether the order you desire is even or odd, respectively. A lowpass example with approximate amplitude 1 from 0 to 0.4 Hz, and approximate amplitude 0 from 0.5 to 1.0 Hz is

From 0.4 to 0.5 Hz, firpm performs no error minimization; this is a transition band or "don't care" region. A transition band minimizes the error more in the bands that you do care about, at the expense of a slower transition rate. In this way, these types of filters have an inherent trade-off similar to FIR design by windowing.

To compare least squares to equiripple filter design, use firls to create a similar filter. Type

and compare their frequency responses using FVTool:

Note that the y-axis shown in the figure below is in Magnitude Squared. You can set this by right-clicking on the axis label and selecting Magnitude Squared from the menu.

The filter designed with firpm exhibits equiripple behavior. Also note that the firls filter has a better response over most of the passband and stopband, but at the band edges (f = 0.4 and f = 0.5), the response is further away from the ideal than the firpm filter. This shows that the firpm filter's maximum error over the passband and stopband is smaller and, in fact, it is the smallest possible for this band edge configuration and filter length.

Think of frequency bands as lines over short frequency intervals. firpm and firls use this scheme to represent any piecewise linear desired function with any transition bands. firls and firpm design lowpass, highpass, bandpass, and bandstop filters; a bandpass example is

Technically, these f and a vectors define five bands:

Example highpass and bandstop filters are

An example multiband bandpass filter is

Another possibility is a filter that has as a transition region the line connecting the passband with the stopband; this can help control "runaway" magnitude response in wide transition regions:

The Weight Vector

Both firls and firpm allow you to place more or less emphasis on minimizing the error in certain frequency bands relative to others. To do this, specify a weight vector following the frequency and amplitude vectors. An example lowpass equiripple filter with 10 times less ripple in the stopband than the passband is

A legal weight vector is always half the length of the f and a vectors; there must be exactly one weight per band.

Anti-Symmetric Filters / Hilbert Transformers

When called with a trailing 'h' or 'Hilbert' option, firpm and firls design FIR filters with odd symmetry, that is, type III (for even order) or type IV (for odd order) linear phase filters. An ideal Hilbert transformer has this anti-symmetry property and an amplitude of 1 across the entire frequency range. Try the following approximate Hilbert transformers and plot them using FVTool:

You can find the delayed Hilbert transform of a signal x by passing it through these filters.

The analytic signal corresponding to x is the complex signal that has x as its real part and the Hilbert transform of x as its imaginary part. For this FIR method (an alternative to the hilbert function), you must delay x by half the filter order to create the analytic signal:

This method does not work directly for filters of odd order, which require a noninteger delay. In this case, the hilbert function, described in Specialized Transforms, estimates the analytic signal. Alternatively, use the resample function to delay the signal by a noninteger number of samples.

Differentiators

Differentiation of a signal in the time domain is equivalent to multiplication of the signal's Fourier transform by an imaginary ramp function. That is, to differentiate a signal, pass it through a filter that has a response H() = j. Approximate the ideal differentiator (with a delay) using firpm or firls with a 'd' or 'differentiator' option:

To obtain the correct derivative, scale by pi*fs rad/s, where fs is the sampling frequency in hertz. For a type III filter, the differentiation band should stop short of the Nyquist frequency, and the amplitude vector must reflect that change to ensure the correct slope:

In the 'd' mode, firpm weights the error by 1/ in nonzero amplitude bands to minimize the maximum relative error. firls weights the error by (1/)2 in nonzero amplitude bands in the 'd' mode.

The following plots show the magnitude responses for the differentiators above.


Previous page  Windowing Method Constrained Least Squares FIR Filter Design Next page

© 1994-2005 The MathWorks, Inc.