You are on page 1of 11

Chapter 5

Chapter 5

FILTER MODELS
AND SIMULATION
TECHNIQUES
EXAMPLES & CODES
5.3 IIR and FIR Filter Implementations

 Example 5.1. In order to illustrate the preceding technique, consider the following
MATLAB program, which determines the impulse response of a fourth-order Butterworth
filter using both block and serial (sample-by-sample) processing:
 % File: c5 filterex1.m

2
5.4 IIR Filters: Synthesis Techniques
and Filter Characteristics

Example 5.2. From (5.17) the first step is to take the inverse Laplace transform of Ha(s).
This gives the impulse response

Example 5.3. In this example we again use (5.18) as the analog prototype. The step
response of the analog filter is

Example 5.4. In order to illustrate the bilinear z-transform synthesis method we once again
turn to the simple first-order analog prototype defined by (5.18). By definition, the bilinear
z-transform filter has the transfer function

3
5.4 IIR Filters: Synthesis Techniques
and Filter Characteristics
 Example 5.5. In this example the responses of the three filters designed in the last three
examples will be compared. Assume that the sampling frequency is 100 Hz (T = 0.01) and
that the parameter a is 2π(10) so that the 3 dB frequency of the analog filter is 10 Hz. With
these assumed values we have

• Thus, from (5.22), the transfer function of the impulse-invariant filter is

• For the step-invariant filter we have, from (5.30):

• Two versions of the bilinear z-transform filter will be given.


• First, if no frequency prewarping is used, so that the amplitude responses of the analog
prototype filter and the digital filter agree closely for low frequencies

4
• Now suppose that the value of C is chosen so that the frequency responses are matched
at the 3 dB frequency of the analog filter. For this case

• The amplitude responses of the impulse invariant, the step invariant, and the first
bilinear z-transform filter, described by (5.47), are generated using the following
MATLAB code:
% File: c5 threefilters.m

5
5.4 IIR Filters: Synthesis Techniques
and Filter Characteristics
Example 5.6. The filter developed in the previous example was based on a very simple
first-order prototype and the filter coefficients: the values of ak and bk were determined
without computer aid.
In this example we consider a fifth-order elliptic filter with 1 dB passband ripple and a
minimum 20 dB stop-band attenuation. While it is certainly possible to determine the filter
coefficients using the analytical techniques illustrated in the preceding example,
considerable effort would be required because of the complexity of the transfer function of
the analog prototype. MATLAB, however, has a number of digital filter synthesis tools in the
Signals and Systems Toolbox. Among these are routines for the design of impulse-invariant
and bilinear z-transform digital filters. The MATLAB code for the synthesis of the fifth-order
elliptic filter is as follows:
% File: c5 ellipexam.m

6
5.4 IIR Filters: Synthesis Techniques
and Filter Characteristics
 Example 5.7. A channelizing filter is to be developed having the characteristic illustrated
in Figure 5.9. Note that the filter passes two channels, only one of which has been
translated to dc. Note also that frequency in Figure 5.9 is normalized with respect to the
Nyquist frequency (one-half the sampling frequency). In terms of this normalized
frequency fN = f / (fs / 2), the filter amplitude response is defined as

• The MATLAB program for designing the filter is as follows:


 % File: c5 yw.m

7
5.5 FIR Filters: Synthesis Techniques
and Filter Characteristics
 Example 5.8. In this example we design a digital lowpass filter that approximates an ideal
digital filter with a bandwidth of λfN = λfs / 2, where fN is the Nyquist rate, fs is the sampling
frequency, and λ is a parameter between 0 and 1. Thus the desired amplitude response is

• Note that h1[0] = h1[L] = λ.


• The following MATLAB code is used to explore the preceding technique:
 % File: c5 FIRdesign.m
8
5.5 FIR Filters: Synthesis Techniques
and Filter Characteristics
 Example 5.9. In this example we design a digital lowpass filter having the amplitude response
of an analog Butterworth filter but also having linear phase. There is no analog equivalent to
this filter. The Butterworth filter is defined by the amplitude response

• The next step is to sample the frequency response. The frequency response samples are given
by

• An inverse FFT operation is then performed on these frequency samples to generate the
impulse response. Keep in mind that, for an N-point inverse FFT, the negative time samples will
appear in the returned vector with index ranging from (N/2) + 1 to N and must be reindexed to
give the proper impulse response. The code for computing the impulse response samples for a
linear phase filter having a Butterworth amplitude response follows.
 % File: c5 firbutter.m 9
5.5 FIR Filters: Synthesis Techniques
and Filter Characteristics
 Example 5.12. As an example of computer-aided design of FIR filters and the Parks-
McClellan algorithm, consider the desired amplitude response shown in Figure 5.9. The
MATLAB program for determining the impulse of the desired filter follows:
% File: c5 pmc.m

10
THANK YOU
11

You might also like