DSP Notes 4
DSP Notes 4
y(n)=4,xn-i) (13.1)
i=0
The IIR system is recursive type and output depends on past and present samples of the input and
also on past output samples.
N M
y(n)=ax(n-i)-yn-k) (13.2)
i=0 k=1
Depending on the impulse response of the system, digital filters are divided into two types:
" Finite Impulse Response (FIR) filters
" Infinite Impulse Response (IIR) filters
Ifthe impulse response sequence of the filter is of finite duration, then the filter is called FIR filter
and if the impulse response sequence is of infinite duration, then the filter is called IIR filter.
This chapter covers design of FIR filters with examples.
13.2.1 Classification of Digital Filters
Filter is essentially a system, which rejects unwanted frequencies of the input signal and allows
the desired frequency components of a signal. Filters are of four types. They are:
" Low.pass filter
"High pass filter
" Band pass filter
" Band reject filter
Low pass filter
The low pass filter allows the signal 0 < <a, topass and signal in the stop band o> 0, are
blocked. Magnitude response of idealand practical low pass filter are shown in Figure 13.1(a).
He
Ideal
Practical
.-- Ideal
|H(e
Practical
Practical
Ideal
Practical
1-&p
Pass band(0-o)
1+ Sp
Although ideal filter in this region is constant 1,non-ideal filter has fluctuations between
and 1- p can be mathematically expressed as:
1- 8,s|H(O)|s 1+ o, for 0s wS o,
Pass band ripple in dB is given by
A, =20 log,o(1 + ®p).
Stop band(o,-)
In the ideal low pass filter, the magnitude is zero, the non-ideal lowpass filter has a small non
zero magnitude bounded by the attenuation O_. The O_ is the tolerance of the magnitude response
in the stop band and can be mathematically expressed as
0s |H(o)| s &; for 0,SwSn
Stop band attenuation in dB is given by
A,=-20 log,(8).
Transition band (o, ’ @g)
ldeal filter changes from pass to stop band as shown in Figure 13.2 by dotted lines. The non-ideal
filter has atransition band of non-zero width. The cut-off frequency a- is within the transition band.
476 MoDERN D1G1TAL SIGNAL PROCESSING
To design a filter we have to specify the pass band and stop band frequencies (o, and o.) and
their respective ripples (o, and ) or cut-off frequency o.
H(el") is a complex sequence and it can be expressed in terms of real and imaginary parts
Hel") =H(e) +jH{e")
We can also represent H(eJ)interms of magnitude and phase
H(e)=|H(eolelene")
where
and
ZHej) = tan H,(e`a)
Hp(eay
In many applications FIR filters are preferred compared to IIR filters. The following are the
advantages and disadvantages of FIR filters.
13.3.1 Advantages
" Fir filters can be designed exactly
with linear phase response. Linear phase
important requirement in speech processing, medical signal response
and in correlation processing, and processing, data transmisSo
. FIR filters are realized non-linear phase degrades the performance.
non-recursively,
. Quantization noise can be made hence, they are always stable.
negligible for non-recursive realization.
FIR filters are simple toimplement and can be effectively implemented in a multirate D
DSP
system.
FIR FILTERS 477
13.3.2 Disadvantages
Disadvantage of FIR filter compared to IIR filter is, to achieve a specified magnitude response,
higher order filter is required. Hence, memory requirement for filter coefficient storage and
execution time are very high.
n=0
IfN is even, the above summation can be split into two summations as given below
N-1
h(n) e -jon +e
H(er") =
n=0
N_
h(n)e
n=0
478 MoDERN DiGITAL SiGNAL PROCESSING
H(ela) = 2e -
n=)
(13.8)
n =]
Then
n =0
+ h(n)e jon
n=
N+1
484 MoDERN DiGITAL SIGNAL PROCESSING
Figure 13.3
Apractical approach to alleviate this problem is to multiply hy(n) by a window function w(n),
whose duration is finite.
Rectangular window
The rectangular window is denoted by wan) and it is defined by
|1 for 0, 1, ...N 1
|0 otherwise (13.22)
The impulse response of the FIR filter is obtained byy multiplying h(n)with wn)
h(n) =h,n) w;(n)
The Fourier transform of rectangular window is given by
N -1 N-1
WRle)= wp(n)ejan
n=0 n=0
The magnitude response of low pass filter, designed using rectangular window is shownthis in
Figure13.4. When rectangular windowis used, oscillations are present in the stop
band. For
reason the rectangular window is less of practical use.
DjdB|
0
I13 dB
20+
-100
window.
Figure 13.4 Magnitude response of the FIR low pass filter designed using rectangular
Hamming window
The Hamming window is represented by WHam(n) and it is defined by
2tn
0.540.46 cos 0snsN -1
WHam (n) =
N-1 (13.24)
otherwise
|WHa(e"ldB
20 43 dB
40
100
N-1f
WHan(e@) = 27tn
Z0s-05cos
n=0L
The magnitude response of
N -1
(13.27)
Hanning
using Hanning window shows an window is shown in Figure 13.6.A low pass filter produced
approximate difference of 32 dB between its pass band and
band gains as shown in Figure 13.6. stop
|WHanedB
0
-20 32 dB
40
-100
otherwise
FIR FLTERS 487
N-1 2n (N-1)|
2 jon
WBanleay (13.29)
n=0L
N -1
The magnitude response of Bartlett window is shown in Figure 13.7. A low pass filter produced
Iusing Bartlett windowshows an approximate difference of 27 dB between its pass band and stop
hand gains as shown in Figure 13.7.
W'Bar(e dB
27 dB
-20
40
-100
Bartlett window.
Figure 13.7 Magnitude response of the FIR low pass filter designed using
Blackman window
The Blackman window is represented by WBlac(n) and it is defined by
2Tn 4nn
(13.30)
WBlac(n) = 042-0.5 cos N-1
+0.08 cos N -1
0snsN -1
otherwise
-20+ 58 dB
40+
-60+
-100
8t
Hamming -43 dB
8T
Hanning -32 dB
Bartlett 8r
-27 dB
N
Blackman 12
N -58 dB
FIR FLTERS 489
rioples (Ý, = 0) are equal. Kaiser window overcomes the above by incorporating ripple control
parameter ß. The Kaiser window is given by
N-<ns N-1
(13.32)
W; (n)= 2
otherwise
|0
parameter Bis determined by following
where 4 attenuation in the stop band and ripple control
relationship: (13.33)
A=-20 1og,(8)
if As 2ldB
(13.34)
A <50 dB
B=0.5842(A 210+ +0.07886(A - 21) if 21 dB <
if A> 50 dB
2 0.1102(A 8.7)
(13.35)
where 8= min( §,, 3)
Length of the filter Nis given by
A-7.95 (13.36)
A-7.95 N
or
N 2.285 Ao 14.36 Af
The
radians and Afis the normalized transition width in Hz.
in compute wn).
where Ao is the transition width of Kaiser window wan). To
compute coefficients
values of B and N are used to
series expansion method.
Iox) is evaluated using power
L (13.37)
1(*) = 1+ k!
k=1
(0.25x')² (0.25²)*
0.25.12
*) =1+ (2!9)* (3)
(1)
consuming, Kaiser window coefficients wn) are computed by
As computation of wAn) is time
command
using the Matlab
w(n) = Kaiser (N, B)
windows
Examples of FIR filter design using to the output while attenuating high
passes low frequency component
Low pass filter This filter frequency response of FIR filter for symmetric sequence is
frequency component. The
given by
FIR FILTERS 491
when N is odd
N -1
(13.43)
N -3
Or
(13.44)
n =0
EXAMPLE 13.1 Design low pass FIR filter for N=5 and O, =0.5 radian.
Solution For low pass FIR filter, filter coefficients are given by Eq. (13.40). Substituting, N=
5. T=2 and o. = 0.5 radian in Eq. (13.40), we obtain
1
-sin o, (n -) for n #T
n(n-T)
hy(n) =
for n=T
sin(0.5)(1)
h,(1) = h, (3) = =0.15260
0.5
h, (2) = =0.15915
")u(2)
hn)-hAn) Wa(n)
0.0107
h0) =h4) =
=0.082404
h) =h3)
h2) =0. 15915
substituting h(n) and values, we get
given by Eq. (13.43).
For N=5. |He° is )+ 0.0214cos2o
|H{e°)=0.15915 + 0.164808 cos
WHan(0) = WHan(4) = 0
WHan() = Wan(3) = 0.5
WHan(2) =1
hn) =hn) WHan?)
h(0) =h(4) =0
h(1) = h(3) =0.0763
h(2) = 0.15915
For N=5, H(e" is given by Eq. (13.43), substituting h(n) and Nvalues, we get
|H(ero)| =0.15915 +0.1526 cos o
EXAMPLE 13.2 Design low pass FIR filter for N= 4 and , = 0.4
radian.
Solution For lowpass FIR filter, filter coefficients are given by
T= 15and o, =0.4 radian in Eq. Eg. (13.40). SubstitutingN*
(13.40),we get
h,(n) =
TT(n-t)
h,(0) = h3) =sin(0.4)(1.5) =0.11982
1.5%
h,(l) = h,(2)= sin(0.4)(0.5) =0.12647
Using rectangular window 0.57
hn) =h,(n) w(n) = h(n)
FIRFILTERS 493
For N= 4, |He is given by Eq. (13.4D, substituting ho) and Nvalues, we get
|He0.2396 cos 1.Se +0.25294 cos 0.50
Using Hamming window
otherwise
WHan(0) = WHan(3) =0
WHan(1) = WHn2) = 0.75
h(n) =hy(n) Whan(n)
h(0) = h(3) = 0
h(1) = h(2) = 0.0948
For N= 4, |Heo) is given by Eg. (13.41), substituting hn) and Nvalues, we get
|H(ejoy =0.189705 cos 0.50
EXAMPLE 13.3 Design low pass filter for the following desired frequency response using
rectangular., hamming and hanning window.
0s\o|s 3
H,(ea)=
FIR FiLTERS 497
Cut-off frequency: 3
rad