5 IIR Filter
5 IIR Filter
5 IIR Filter
Experiment No.: 05
Title of Experiment
IIR FILTER
Date of Performance:
Experiment No.: 05
IIR FILTER
AIM: To design IIR filter for first order analog Butterworth approximation
OBJECTIVES:
1. Display the order of filter.
2. Get frequency response of the filter.
THEORY:
IIR Filter can closely be obtained by beginning with an analog filter and then using a
mapping to transform the s-plane to z-plane. The design of an analog filter is
reduced to design of an analog filter and performing the conversion from H(s) to
H(z).
IIR Filters:
IIR filters, as the name indicates, have an impulse response h[n] of infinite
duration. Thus the output response of a causal IIR filter for an input sequence a[n]
is given by
y (n) h[k ]x[n k ]
k 0
But in practice, it is not feasible to compute the output yn using Eq. (2.90)
since the impulse response hin) is of infinite duration. So, the output (n) of an IIR
filter is often expressed in a recursive form given by
M N
y[n] bk x[n k ] a k y[n k ]
k 0 k 1
where ak and bk by are the coefficients of the filter. The present output sample
y[n] depends on the past outputs as well as on the present and past input samples.
An IIR filter normally requires fewer coefficients than an FIR filter for the same
set of specifications. Hence, IIR filters are preferred over FIR when sharp cut-off
and high throughput are the important requirements. But IIR filters cannot always
guarantee both stability and a linear phase response which are the key features of
an FIR filter.
Note: Designing a digital IIR filter means obtaining the filter coefficients a k and
bk .
Based on the frequency response characteristics, digital IIR filters can mainly be
classified into Butterworth, Chebyshev (Type I and II) and Elliptical filters. Here,
we discuss the design of digital IIR Butterworth and Chebyshev (Type I and II)
filters using MATLAB functions.
Digital IIR Butterworth Filters
The Butterworth filters are characterised by the magnitude response which is flat
in both passband and stopband. They have a monotonically varying (with
frequency) magnitude response with no ripples in both passband and stopband.
The digital IIR Butterworth filters are implemented in MATLAB using two
functions butter and buttord. Here, we consider the design of Butterworth
lowpass, highpass, bandpass and bandstop filters.
The design of digital IIR Butterworth lowpass filters using MATLAB functions
involves the following steps:
1. Provide the specifications of the filter to be designed.
2. [N, wn] = buttord (wp, ws, Rp, As) computes the filter order N and the cut-off
frequency wn (at -3 dB) from the given specifications. Before being used in the
buttord function, the frequencies wp and ws must be normalised from 0 to
1(where 1 corresponds to radians /sample).
3. [b, a] = butter (N, wn) or [b, a] = butter (N, wn, 'low') computes the filter
coefficients bk and ak in length N+1 vectors b and a, respectively. The cut-off
frequency wn must be 0.0< wn < 1.0, with 1.0 corresponding to π. The input
parameters N and wn are same as that obtained in Step 2.
The above steps design an IIR Butterworth lowpass filter that loses no more than
Rp dB in the passband and has at least As dB of attenuation in the stopband.
ALGORITHM:
PROGRAM:
Butterworth LPF
OUTPUT:
>> BLT
Enter passband attenuation in dB = 0.4
Enter Stopband attenuation in dB = 30
Enter Passband frequency in hz = 400
Enter Stopband frequency in hz = 800
Enter Sampling frequency in hz = 2000
n=
4
wn =
0.5821
CONCLUSIONS:
Thus we designed and implemented IIR filter are of recursive type and having
infinite impulse response.