0% found this document useful (0 votes)
12 views17 pages

DSP Notes 4

Uploaded by

E sravya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views17 pages

DSP Notes 4

Uploaded by

E sravya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

FIR FLTERS 473

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

Figure 13.1(a) Low pass filter.

High pass filter


The high pass filter allows the signal above Q> 0, and rejects the signal between 0 < @< o,.
Magnitude response of ideal and practical high pass filter are shown in Figure 13.1(b).
474 MoDERN DiGITAL SIGNAL PROCESSING

.-- Ideal
|H(e
Practical

Figure 13.1(b) High pass filter.


Band pass filter
The band pass filter allows the signal between o. to o pass and reject the other signal. Magnitude
response of ideal and practical band pass filter are shown in Figure 13.1(c).
|H(e'
Ideal

Practical

Figure 13.1(c) Band pass filter.


Band reject filter
The band reject filter rejects the signal between w,j to o2 passes the
response of ideal and practical band reject filter are shown in Figureremaining
13.1(d).
signal. Magnitude
|H(eo )

Ideal

Practical

Figure 13.1(d) Band reject filter.

13.2.2 FIR Filter Specifications


The characteristics of: filters are specified in the frequency domain. Figure 13.2 shows the magnitude
response of low pass filter. The following are the key parameters:
FIR FLTERS 475

o, =Pass band edge frequency in radians


0, =Stop band edge frequency in radians
o-Cut-off frequency in radians
S, = Pass band deviation (Pass band error tolerance)
8, =Stop band deviation (Maximum allowable magnitude in the stop band)
He
1+&n

1-&p

- Pass band+Stop band


Transition
band

Figure 13.2 Magnitude specification used for filters.

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.

13.3 FIR FILTERS

FIR filter is characterized by the following difference cquation:


N -1

y(n)= ) h(k)x(n - k) = h(n) * x(n) (13.3)


k=0

n) = h(0) x(2) + h( 1)x(n 1) + h(2) x(n 2) + .. + h(N- 1) x(n N+ 1)


hk). k=0. 1,... N-1are the set offilter coeficientsor impulse response coefficients.FIR filters
are non-recursive form, FIR filter output y(n) depends only on the past and present input samples.
The frequency response of FIR filter is given by
N -1

H(e)=h(n) e jan (13.4)


n =0

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.

13.4 LINEAR PHASE IN FIR FILTERS


FIR filters can be designed with linear phase. Ifh(n) represents the impulse response of FIR filter,
the condition for design of such filter is that hn) is either symmetric or anti-symmetric and whose
length Nmust have finite duration to meet design specifications.
For symmetric h(n) = h(N- 1-n) n=0, 1, ... N 1 (13.5)
For anti-symmetric h(n) =h(N 1-n) n=0, 1, ... N-1 (13.6)
Case 1: Symmetric impulse response (N is even).
From Eq.(13.4), frequency response of FIR filter is given by
N -1

n=0

IfN is even, the above summation can be split into two summations as given below

N-1

He")= h(n)e jon h(n) e-jjon


n=0 n
2

Substituting n = N-1-n in the second summation of the above equation we get

h(n)e-jon + h(N-1-)ejo(N -1-n)


H(el") =
n=0 n=0

Since, h(n) =h(N 1l-n)


2 N1
h(n)ejon + ) hn) e joN -)pjon
H(ejo)=
n=0 n=0

h(n) e -jon +e
H(er") =
n=0

N_

h(n)e
n=0
478 MoDERN DiGITAL SiGNAL PROCESSING

H(ela) = 2e -
n=)

He")can be expressed as H(er=|H(e°)|ele. Here |H(e) is magnitude of H(eia) and


LHe") is phase of He ey. Magnitude of H(e/") is given by
-1

|He"|=2 Hn) cosa - n


n=0
(13.7)
N
Ifn = -n, magnitude of H(ely is also given by
2

(13.8)
n =]
Then

H(e")=| H(e")le (13.9)


Phase of H(ej) is given by
sin o
N-1
2
ZH(eja)=tan
N-1
cos o
N
LHery=tan-tan co
N-1
(13.10)
In the above equation is constant, hence, ZH(ejy is linear function of o.
Hence, phase
is linearly proportional to
linear phase filters.
frequency. Thus, when N is even and h(n) is symmetric, FIR
filterS al
Case 2: Symmetric impulse response (Nis
If Nis odd, the Eq. (13.4)
odd).
summation can be split into two summations as given below:
N-3

He)=S h(n)e jon N-1

n =0
+ h(n)e jon
n=
N+1
484 MoDERN DiGITAL SIGNAL PROCESSING

leads to Gibbs phenomenon. Truncation of the infinite


series
Direct truncation of the infiniteundesirable oscillations in the pass band and stop band as shoWn
series results in FIR filters with
in Figure 13.3.
|Heo Oscillations in
pass band and
stop band is called
Gibbs phenomenon

Figure 13.3

Apractical approach to alleviate this problem is to multiply hy(n) by a window function w(n),
whose duration is finite.

h(n) = h,(n) w(n) (13.21)


Most comnmonly used windows are rectangular, Hamming, Hanning and Kaiser windows.
These windows are discussed below:

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

-joN jON - jON


Walee)!-ejoN e 2 2
-e
2 jo(N - 1) sin
2
sin| ON2
1-ejo - jo jo -jo =e (13.23)
e 2 e 2 -e 2
sin
ON
sin
2
Therefore, IWR(ey=
sin
FIR FILTERS 485

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

The Fourier transform of Hamming window is given by


N-1
WHam(n)ejan
Wham(ea) =
n=0

N-1f 2Tn (13.25)


WHam(eay=S 0.54 0.46 cos N -1)
n =0
produced
The magnitude response of Hammingwindow is shown in Figure 13.5. A low pass filter band and
using Hamming window shows an approximate difference of 43 dB between its pass
stop band gains as shown in Figure 13.5.
Hanning window
The Hanning window is represented by WHan(n) and it is defined by
2Ttn
WHan (n)
0.5 -0.5 cos| N-1
0snsN -1
(13.26)
0 otherwise
486 MoDERN DiGITAL SIGNAL PROCE SSING

|WHa(e"ldB

20 43 dB

40

100

Figure 13.5 Magnitude response of the FIR low pass filter


designed using Hamming window
The Fourier transform of Hanning
N -1
window is given by
WHan (n)ejon
n=0

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

Figure 13.6 Magnitude response of the


FIR low pass filter
Bartlett (triangular) window designed using Hanning window.
The Bartlett or
triangular window is represented by wpar(n) and it is defined by
(N-1)
WBar (n) =}1 2
N-1 0sns N -1 (13.28)

otherwise
FIR FLTERS 487

transform of Bartlett window is given by


The Fourier
N-1
jon
WBarle)=W (m)e

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

The Fourier transform of Blackman window is given by


N-1
Jwn
WBla(e) = WBac (n) e
n=0

N-If 2Tn 4nn


WBlacleay= 0.42-0.5 cos +0.08 cos jOn
(13.31)
n=0L
N-1) N-1
PROCESSING . Alow pass filter produced
488 MoDERN DIGITAL SIGNAL Figure 13.8..
shown in band and
of Blackman window difference of 58 dB between its pass
is
The magnitude response
window shows an
approximate
using Blackman
shown in Figure 13.8.
stop band gains as
|WAl(e"jdB

-20+ 58 dB

40+

-60+

-100

low pass filter designed using Blackman window.


Figure 13.8 Magnitude response of the FIR
the rectangular windowand magnitude of
The main lobe width of Hanning window is twice ofHanning window results in smaller ripples
side lobes is lower than that of rectangular window. less oscillation in the side lobes
both in pass band and stop band. Hamming window generates window is generally
than Hanning windowand main width is almost same, hence, hamming attenuation in
preferred. Table 13.1 gives the width of the transition region to obtain the desired
the stop band.
Kaiser window
Design of FIR filters with the above window functions, we assume pass band and stop band
Table 13.1 Transition Width and Attenuation of Window Functions
Windows Transition width Attenuation
47
Rectangular -13 dB

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

h,(0) =h, (4) =sin(0.5)\2)


2T
=0.1339

sin(0.5)(1)
h,(1) = h, (3) = =0.15260
0.5
h, (2) = =0.15915

Using rectangular window


|h(n) =hy(n) w,(n) =h,(n)
For N= 5, |H(ej")l is given by Eq. (13.43), substituting h(n) and N values, we get
|H(e")|=0.15915,+ 0.30521 cos w+ 0.2678 cos2w
Using Hamming window
h(n) = h,(n) Wifam 1)
For N= 5, WHam(n) is given by
2nn
WHam(n) = 0.54 -0.46 cos N-1
0<n<4
0
otherwise
WHam(0) = WHam(4) = 0.08
WHam(1) = WHam3) = 0.54
PROCE SSING
492 MoDERN D1GIIAL SIGNAL

")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

Using Hanning window


h(n) = h,(n) WHan(1)
For N=5, WHan) is given by
2Tn 0sns4
WHan(n) = 0.5-0.5 cos N-1)
otherwise

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

where wam( 2) for N= 4is given by


2rn
"Ham () = los4 0.46 co
0sns3
N-1
otherwise
WHam(0) =WHam(3) = 0.08
Wham)=WHam(2) =0.77
hn) = h,(m) WHam(")
h(0) = h(3) = 0.00958
h(1) = h3) =0.0973
For N= 4. |Hezy is given by Eq. (13.41), substituting h(n) and Nvalues, we get
|H(ela) =0.019168 cos 1.50+0.1946 cos 0.50
U'sing Hamning window
h(n) = h,n) WHan(")
where wan(n) for N= 4 is given by
2tn
WHan(1) = o.5-0.5cos N-1)
0sns3

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

Since Nis odd, frequency response of symmetric FIR filter is given by


N-I

h(3) +> 2h(3 - n) cos on


n=1

|H(e") = h3) + 2h(2) cos o + 2h( 1) cos 2o+ 2h(0) cos3o


Comparing the above equation with the frequency response given in the problem, we get
h(0) = h(6) =-10.248 x 106
h(1) = h(5) = 0.04268
h(2) = h(4) =0.21228
h(3) = 0.3334
EXAMPLE 13.6 Obtain filter order N and Bfor a low pass FIR filter using Kaiser window,
for the following specifications:

Cut-off frequency: 3
rad

Transition width Aa 0.015n rad


Maximunm stop band attenuation &,; 0.02
Compute filter coefficients of low pass FIR filter using Matlab.
Solution
S= min (,, S,) = 0.02. Stop band ripple in dB
A=-20log,() =-20 log, (0.02) = 33.979 dB =34
B=0.5842(4 -21)0* +0.07886(4 - 21)
B=0.5842(34 - 21)0 4+ 0.07886(34 21) = 2.6549
where length of the filter N is given by
A-7.95 34 7.95
N: -2241.924=242
2.285 Aw 2.285 x 0.15

Kaiser window is determined by using the Matlab command


w= Kaiser (N, B)
w= Kaiser (242, 2.6549)
The flter coefficients are obtained by multiplying the
with w.
impulse response of the ideal filter hAn)
EXAMPLE 13.7 Design a low pass FIR filter using Kaiser windaw for the
specifications: following
Cut-off frequency: 2200 rad/sec
Transition width: 900 rad/sec
498 MoDERN DiGITAL SIGNAL PROCESSING

Sampling frequency: 12 kHz


50 dB
Maximum stop band attenuation:
Pass band ripple: 0.015 dB
Solution

Step 1: Convert analog frequency to digital frequency


9007
Transition width Ao: =0.075n rad
12 x 10
22007
Cut-oft frequency: =0.1833T rad
12x10'
Step 2: To compute S and 4
20 log,o(1+ S,)= 0.015 ’ 8,= 1.728 x 103
-20 log,o(8JF 50 ’ 8=3.162 x103
S= min(, S) = 1.728 x 103
A=-20 log,() =-20 log,(1.728 x 103)= 55.249 dB
Step 3: To compute Band N
B=0.1102(4 8.7)= 0.1102(55.249 - 8.7) = 5.129
A-7.95
N =88
2.285 Ao

Step 4: Kaiser window is determined by using the Matlab command


w= Kaiser (N, B)
w= Kaiser (88, 5.129)
Step 5: The filter coefficients are obtained by multiplying the impulse response of the ideal
filter hn) with w.
EXAMPLE 13.8 What is the approximate stop band attenuation, if FIR filter is designed using
Kaiser window for the following specifications:
Pass band edge frequency: 0.258r rad
Stop band edge frequency: 0.3547 rad
N= 68

Solution Length of the filter Nis given by


N
A-7.95 A-7.95
2.285 Ao =68
2.285 x (0.354n -0.258r)
A=54.811=55
A=-20 log,(), 55 =-20 log,(), and hence, B= 1.7782 × 103

You might also like