<< Chapter < Page Chapter >> Page >

Filter design

This section gives an extended explanation of how to use M atlab to design a bandpass filter to fit a specified frequency response with a flat passband. The same procedure(with suitable modification) also works for the design of other basic filter types.

A bandpass filter is intended to scale, but not distort, signals with frequencies that fall within the passband, and to rejectsignals with frequencies in the stopband. An ideal, distortionless response for the passbandwould be perfectly flat in magnitude, and would have linear phase (corresponding to a delay).The transition band from the passband to the stopband should be as narrow as possible.In the stopband, the frequency response magnitude should be sufficiently small and the phase is of no concern.These objectives are captured in [link] . Recall (from [link] ) for a real w ( t ) that | W ( f ) | is even and W ( f ) is odd, as illustrated in [link] .

M atlab has several commands that carry out filter design. The firpm command Some early versions of M atlab use remez instead of firpm . provides a linear phase impulse response (with real, symmetric coefficients h [ k ] ) that has the best approximation of a specified (piecewise flat) frequencyresponse. There are many possible meanings of the word “best”; for the firpm algorithm, “best” is defined in terms of maintaining an equal ripple in the flat portions. The syntax of the firpm command for the design of a bandpass filter as in [link] is     b = firpm(fl,fbe,damps) which has inputs fl , fbe , and damps , and output b .

Specifications of a real-valued bandpass filter in terms of magnitude and phase spectra.
Specifications of a real-valued bandpass filter in terms of magnitude and phase spectra.
  • fl specifies (one less than) the number of terms in the impulse response of the desired filter. Generally, more is betterin terms of meeting the design specifications. However, larger fl are also more costly in terms of computation and in terms ofthe total throughput delay, so a compromise is usually made.
  • fbe is a vector of frequency band edge values as a fraction of the prevailing Nyquist frequency.For example, the filter specified in [link] needs six values: the bottom of the stopband (presumably zero), the top edge of the lower stopband(which is also the lower edge of the lower transition band), the lower edge of the passband, the upper edge of the passband,the lower edge of the upper stopband, and the upper edge of the upper stopband (generally the last value will be 1).The transition bands must have some nonzero width (the upper edge of the lower stopband cannot equalthe lower passband edge) or M atlab produces an error message.
  • damps is the vector of desired amplitudes of the frequency response at each band edge. The length of damps must match the length of fbe .
  • b is the output vector containing the impulse response of the specified filter.

The following M atlab script designs a filter that mimics [link] : fbe=[0 0.24 0.26 0.74 0.76 1];  % frequency band edges as a%   fraction of the Nyquist frequency damps=[0 0 1 1 0 0];            % desired amplitudes at band edges fl=30;                          % filter sizeb=firpm(fl,fbe,damps);          % b is the designed impulse response freqz(b)                        % plot frequency response to check design

bandex.m design a bandpass filter and plot frequency response (download file)
[link] . Observe that the stopband is about 14 dB lower than thepassband, a marginal improvement over the naive lowpass filter of [link] , but the design is much flatter in the pass band. The “equiripple” nature of this filteris apparent in the slow undulations of the magnitude in the passband.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Software receiver design. OpenStax CNX. Aug 13, 2013 Download for free at http://cnx.org/content/col11510/1.3
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Software receiver design' conversation and receive update notifications?

Ask