IIR Digital Filtyttyer Structures Filter Design
IIR Digital Filtyttyer Structures Filter Design
Direct form IIR filter: Filter structures in which the multiplier coefficients are
precisely the coefficients of the transfer function
where
The filter section H1(z) can be seen to be an FIR filter and can be realised:
Cascade of the two structures leads to H(z) and is known as direct form I
structure
Now, it is canonic
H ( z)
P( z ) P1 ( z ) P2 ( z ) P3 ( z )
D( z ) D1 ( z ) D2 ( z ) D3 ( z )
Usually, the polynomials are factored into a product of 1st order and 2nd
order polynomials:
Consider an example:
How?
1
1 0.8 z 1 0.5 z 2
1 0.4 z
H ( z)
Hint: try to remember a general form for direct form II and then reuse it!
in z-1 yields
H ( z)
0.25
0.25
0.6
0.1
1
1
1 ( 0.4 j 0.5831) z
1 (0.4 j 0.5831) z
1 0.4 z 1
Use
Parallel form I
a
b
a (1 B ) b(1 A)
1 A 1 B
(1 A)(1 B )
10
in z yields
0.24 z 1
(0.1 j 0.1458) z 1
(0.1 j 0.1458) z 1
H ( z)
a
b
a (1 B ) b(1 A)
1 A 1 B
(1 A)(1 B)
Parallel form II
11
12
An ideal LPF
Its impulse
Inverse DFT
Similar to
DFT
Filter length
N=13
N=25
Infinite N
15
N=51 and wc
16
Step 2 - Obtain impulse response, hD(n) of the desired filter by evaluating the
inverse Fourier transform
Important note: well look at hD(n) for standard filter designs in the next slide
Step 3 - Select a window function and then the number of filter coefficients
Step 4 - Obtain values of w(n) for the chosen window function and the values of
the actual FIR coefficients, h(n), by multiplying h D(n) with w(n)
h(n)=hD(n) w(n)
17
18
To reduce the passband and stopband ripple , the area under the
sidelobes should be small so to increase the stopband attenuation, we
need to decrease the sidelobe amplitude
20
To obtain good (i.e. sharper) transition band reduce main lobe width
increase the filter length
Eg: Frequency response of Hamming window with length 101 and 201
are shown below
50
Magnitude (dB)
Magnitude (dB)
50
0
-50
-100
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
200
Phase (degrees)
Phase (degrees)
-50
-100
200
0
-200
-400
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
0
-200
-400
21
21
Magnitude (dB)
Magnitude (dB)
50
-50
-100
-150
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
-100
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
-1000
Phase (degrees)
Phase (degrees)
-50
-150
-2000
-3000
-4000
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
-2000
-4000
-6000
22
Kaisers formula:
20 log10 p s 13
14.6(s p ) / 2
14.6( f s f p )
Bellangers formula:
20 log10 p s 13
2 log10 10 p s
3( f s f p )
Hermanns formula is more complex so we will not consider here (but generally it
gives slightly more accurate value for the order)
23
20 log10 0.0115(0.0178) 13
14.6(2000 / 12000 1800 / 12000)
24
Another example
A requirement exists for an FIR digital filter to meet the following specifications:
Passband: 150-250 Hz
Transition width: 50 Hz
Stopband attenuation: 60 dB
20 log10 0.0115(0.001) 13
Using Kaisers formula: N
14.6(50 / 1000)
which give N=49.85. So, we could take N=50 (type 1, odd length)
Note that the passband information is not used to obtain N, so it will be the same
even if we shift the passband or even if we use it for highpass, stopband etc
If the transition bands are not same then we use the smaller transition band
20 log10 p s 13
14.6( f s f p )
25
A common mistake
0.2
0.1
0
-0.1
-0.2
-0.3
-0.4
20
40
60
80
100
120
Problem
The phase is completely non-linear
The magnitude response is not good
0
-5
-10
-15
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
80
Phase (degrees)
Magnitude (dB)
60
40
20
0
26
0.4
0.3
0.2
0.1
0
-0.1
-0.2
-0.3
-0.4
50
100
150
200
250
Magnitude (dB)
50
0
-50
-100
-150
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
5000
Phase (degrees)
0
-5000
-10000
27
0.4
0.9
0.3
0.8
0.2
0.7
0.1
0.6
0.5
0.4
-0.1
0.3
-0.2
0.2
-0.3
0.1
0
50
100
150
200
250
-0.4
50
100
150
200
250
50
Magnitude (dB)
0
-50
-100
-150
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
5000
Phase (degrees)
0
-5000
-10000
28
20
20
0
Power Spectrum Magnitude (dB)
-20
-40
-60
-80
-100
-20
-40
-60
-80
-100
0.1
0.2
0.3
0.4
0.5
0.6
Frequency
0.7
0.8
0.9
-120
0.1
0.2
0.3
0.4
0.5
0.6
Frequency
0.7
0.8
0.9
29
0.08
0.06
0.04
0.02
0
-0.02
-0.04
-0.06
-0.08
20
20
50
100
150
200
250
-20
-40
-60
-80
-100
-0.1
-20
-40
-60
-80
-100
0.1
0.2
0.3
0.4
0.5
0.6
Frequency
0.7
0.8
0.9
-120
0.1
0.2
0.3
0.4
0.5
0.6
Frequency
0.7
0.8
0.9
30
The windows such as Hanning, Hamming etc are known as fixed window designs as
the ripple values are fixed)
FIR filter design can also be improved using adjustable window functions such as
Dolph-Chebyshev and Kaiser that provide control over by means of an additional
parameter characterising the window
The basis of FIR filter design is to obtain the set of minimal number of coefficients
for the required response
Note: Kaiser order and Kaiser window are two different matters, though we normally use them
together
31
MATLAB functions
ellip Elliptic filter with ripples (but normally requiring lower order than
Butterworth for same transition band)
First step is to estimate the order of the filter given the specifications using
functions: buttord, cheb1ord, cheb2ord, ellipord etc
Next, obtain the coefficients, B and A using functions: buttord, besself, cheby1,
cheby2, ellip, etc
The frequency response of the filter can be obtained using function freqz(B,A)
33
Design an elliptic IIR low-pass filter with the specifications: Fp=0.8 kHz,
Fs=1 kHz, FT=4 kHz, p=0.5 dB, s=40 dB
MATLAB code:
[N,Wn]=ellipord(0.4,0.5,0.5,40)
[B,A]=ellip(N,0.5,40,Wn)
Magnitude (dB)
0
-50
-100
-150
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
Phase (degrees)
0
-100
-200
-300
-400
34
20
20
0
Power Spectrum Magnitude (dB)
-20
-40
-60
-80
-40
-60
-80
-100
-100
-120
-20
0.1
0.2
0.3
0.4
0.5
0.6
Frequency
0.7
0.8
0.9
-120
0.1
0.2
0.3
0.4
0.5
0.6
Frequency
0.7
0.8
0.9
35