fwhomfbrhi27435fwhomfbrhi
TRANSCRIPT
-
7/29/2019 fwhomfbrhi27435FWHOMFBRHI
1/19
Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
1
Finite Impulse Response Filters
Introduction: In the design of frequency selective filters, the desired filter characteristics are specified in the
frequency domain in terms of the desired magnitude and phase response of the filter. In the filter design
process, we determine the coefficients of a causal FIR or IIR filter that closely approximates the desired
frequency response specifications. The issue of which type of filter to design, FIR or IIR depends on the
nature of the problem and on the specifications of the desired frequency response.
In practice, FIR filters are employed in filtering problems where there is a requirement for a linear phase
characteristic within the pass band of the filter. If there is no requirement for a linear phase characteristic,
either an IIR or an FIR filter may be employed. However, as a general rule, an IIR filter has lower side lobes
in the stop band than an FIR filter having the same number of parameters. For this reason, if some phase
distortion is either tolerable or unimportant, an IIR filter is preferable, primarily because its implementation
involves fewer parameters, requires less memory and has lower computational complexity.
FIR filters: If the impulse response of the digital filter is determined by some finite number of impulse
sequences then these filters are known as FIR Filters. In other words it can be defined as the unit sample
response of an LTI system is of finite duration, then the system is said to be FIR system or filter. FIR
filters are recursive filters. The present output sample depends only on present and past inputs, but not on
past outputs. Since FIR filters have no feedback, they have no poles and are therefore always stable. Theadvantages and disadvantages of FIR filters over IIR filters are described below.
Advantages:
1, FIR filters are always stable.
2. Fir filters with exactly linear phase can easily be designed.
3. Fir filters can be realized in both recursive and non-recursive structures.
4. FIR filters are free limit cycle oscillations, when implemented on a finite word length digital system.
5. Excellent methods are available for various kinds of FIR filters.
Disadvantages:
1. The implementation of narrow transition band FIR filters are very costly, as it requires considerably more
arithmetic operations and hardware components such as multipliers, adders and delay elements.
2. Memory requirement and execution time are very high.
-
7/29/2019 fwhomfbrhi27435FWHOMFBRHI
2/19
Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
2
Linear Phase FIR Filters and its properties:
An FIR filter of length N with input [ ]x n and output [ ]y n is described by the difference equation
0 1 1
1
0
[ ] [ ] [ 1] . [ 1]
[ ]
. . . NN
kk
y n b x n b x n b x n N
b x n k
=
= + + +
=
+
(1)
where kb is the set of linear coefficients. Alternatively we can express the output sequence as the
convolution of the unit sample response [ ]h n of the system with the input signal. Thus we have
1
0
[ ] [ ] [ ]N
k
y n h k x n k
== (2)
where the lower limit and upper limits on the convolution sum reflect the causality and finite duration
characteristics of the filter.
The filter can also be characterized by its system function
1
0
[ ] [ ]N
n
n
H h nz z
== (3)
which we view as a polynomial of degree 1N in the variable 1z . The roots of this polynomial constitute
the zeros of the filter.
The frequency response of the filter is obtained by substituting jz e= in equation (3), thus we get
1
0
[ ] [ ]N
j jn
n
H h ne e
== (4)
Which is periodic with period 2 . The frequency response is represented by its magnitude and phase
responses as
[ ][ ] | [ ] |j j j H H ee e = (5)
where | [ ] |jH e is magnitude response and [ ] is the phase response.
Phase delay: The phase delay is defined as the negative ratio of phase [ ] and frequency of a filter.
i.e.,[ ]
p
= . (6)
Group delay: The group delay is defined as the negative differentiation of [ ] with respect to . In
other words it also can be defined as the rate of phase response with respect to frequency i.e.,
[ ]d
gd
= . (7)
Linear Phase Characteristics:
For FIR filters with linear phase we can define [ ] = (8)
where is a constant phase delay in samples. Substituting in equations (6) and (7), we get
-
7/29/2019 fwhomfbrhi27435FWHOMFBRHI
3/19
Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
3
[ ] p
= == and [ ]
d d g
d d = == . Therefore p g = = which means
independent of frequency. Therefore to obtain a linear phase characteristics, the FIR digital filter both phase
delay and group delay should be constant.
Proof:
From equations (4) and (5) , we can write1
[ ]
0
[ ] | [ ] |N
jn j j
n
h n H ee e
== or
1
0
[ ]{cos sin } | [ ] |{cos [ ] sin [ ]}N
j
n
h n n j n H j e
= = + (9)
which gives us1
0
[ ] cos | [ ] | cos [ ]N
j
n
h n n H e
== and
1
0
[ ] sin | [ ] | sin [ ]N
j
n
h n n H e
= =
By taking their ratio
1
01
0
[ ]sin| [ ] | sin [ ] sin [ ] sin( ) sin( )
cos [ ] cos( ) cos( )| [ ] | cos [ ][ ]cos
N
jn
jN
n
h n nH
H h n n
e
e
=
=
= = = =
After cross multiplying and simplifying we get1
0
[ ] sin ( ) 0N
n
h n n
= = (10)
The above equation is zero when [ ] [ 1 ]h n h N n= and 12
N = (11)
Refer Fig 1(a) and (b)
In the case of only constant group delay is required, and not phase delay, we define [ ] k = . If
2 = then [ ] [ 1 ]h n h N n= and
1
2
N
= . Refer Fig 1(c) and (d).
-
7/29/2019 fwhomfbrhi27435FWHOMFBRHI
4/19
Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
4
Frequency Response of Linear Phase FIR Filters:
Case 1: Symmetrical Impulse Response and N is odd:
1
| [ | [ ] 2 [ ]cos ,k
jk
n
H e h h k n n=
= + and [ jH e k = , where 12Nk = .
1
| [ ] | [ ] 2 [ ]cos ,k
jk
n
H e h h k n n=
= + and [ ]jH e k = , where 12Nk = .
Applications: L.P.F., H.P.H., B.P.F., and B.R.F
Case 2: Symmetrical Impulse Response and N is even:
/212
12
| [ ] | 2 [ ]cos )N
j
n
NH e h n ( n=
= and ( )12[ ]j NH e =
Applications: L.P.F., and B.P.F
Case 3:Anti-symmetrical Impulse Response and N is odd:
12
1
12
| [ ] | 2 [ ]sin
N
j
n
NH e h n n
=
= and ( )12 2[ ]j NH e =
Applications: Differentiator and Hilbert Transform.
-
7/29/2019 fwhomfbrhi27435FWHOMFBRHI
5/19
Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
5
Case 4:Anti-symmetrical Impulse Response and N is even:
2
)12 2
1
| [ ] | 2 [ ]sin
N
j N
n
H e h n (n - n=
= and ( )12 2[ ]j NH e =
Applications: Differentiator and Hilbert Transform.
Designing FIR Filters:
Fourier Series Method: The frequency response [ ]jH e of a system is periodic in period 2 . By
Fourier series method, any periodic function can be expressed as a linear combination of complex
exponentials. Therefore the desired frequency response of an FIR filter can be represented by Fourier Series.
That is [ ] [ ] ,j jndn
H e h n e
== where 12[ ] [ ]
j jndh n H e e d
= .
The Z.T. of sequence is, [ ] [ ] ndn
H z h n z
== which is an infinite duration sequence. To get FIR filter
transfer function the series can be truncated by assigning [ ] [ ]dh n h n= for1 1
2 2N Nn . That is
1 12 2[ ], for[ ]0, Otherwise
d N Nnh nh n
=
. Then
( ) ( )
[ ]
11 12
2 2
12
12
1 1
1
1 12 2
[ ] [ ] . . . . ( 1) (0) (1) . . .
(0) [ ] [ ]
NN N
N
N
n
n
n n
n
N NH z h n z h z h z h h z h z
h h n z h n z
=
=
= = + + + + + +
= + +
For a symmetrical impulse response having symmetry at 0n = . That is [ ] [ ]h n h n = .
Therefore [ ]
12
1
[ ] (0) [ ]
N
n n
n
H z h h n z z
== + + . This transfer function is not physically realizable. Realizability
can be brought by multiplying by1
2N
z
, where 12
N is the delay in samples.
-
7/29/2019 fwhomfbrhi27435FWHOMFBRHI
6/19
Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
6
Therefore the physically realizable filter transfer function can be written as
[ ]
12
11 2
2
1
[ ] [ ]
(0) [ ]
N
NN
n n
n
H z z H z
z h h n z z
=
=
= + +
Ex1:Design an ideal LPF with a frequency response| |
2 2
| |2
1, for[ ]
0, for
jd
H e
=
. Find the values of
[ ]h n for 11N= . Find [ ]H z and plot its response. Use Fourier series method.
Solution:
1 12 2
21 12 2
2
[ ] [ ] [ ]
sinsin1.
c
c
c
c
j jn j jn
d
cjn
h n H e e d = H e e d
n n= e d = n
n n
=
=
Given that 11N = . Therefore 1 11 12 2
5Nn = = = .
21
22
sin, for 5 5
[ ]
0, Otherwise
d
nn
nh n
=
21 12 20 0
2
sin[0] lim [ ] limd dn n
nh h n
n
= = =
or
01 1 122 2 2
2
[0] [ ] 1c
c
j jd
h H e e d = d =
=
2 12
2 13
2 15
sin[ 1] [1] 0.3183
sin[ 2] [2] 0
2
sin3[ 3] [3] 0.106
3
sin2[ 4] [4] 0
4
sin5[ 5] [5] 0.063665
d d
d d
d d
d d
d d
h h
h h
h h
h h
h h
= = = =
= = =
= = = =
= = =
= = = =
The transfer function of the filter
[ ] [ ]
12
1 1
1 3 3 5 5
5[ ] (0) [ ] [ ] 0.5 [ ]
0.5 0.3183( ) 0.106( ) 0.06366( )
N
n n n n
n n
H z h h n z z H z h n z z
z z z z z z
= =
= + + = = + +
= + + + + +
-
7/29/2019 fwhomfbrhi27435FWHOMFBRHI
7/19
Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
7
The transfer function of realizable filter1
2[ ] [ ]N
H z z H z
=
152
5
5
1 3 3 5 5
2 4 6 8 10
[ ] [ ] [ ]
0.5 0.3183( ) 0.106( ) 0.06366( )
0.06366 0.106 0.3183 0.5 0.3183 0.106 0.06366
N
H z z H z z H z
z z z z z z z
z z z z z z
= =
= + + + + +
= + + + +
Frequency Response: To find the frequency response substitute jz e= in [ ]H z .
3 3 5 5[ ] 0.5 0.3183( ) 0.106( ) 0.06366( )
0.5 0.6366 cos 0.212cos3 0.127cos5
j j j j j j j dH e e e e e e e
= + + + + +
= + +
The magnitude response is shown in Figure.
Designing FIR filters using Windows: The main limitations of Fourier series method is oscillations in
the pass band and stop band due to the slow convergence. This effect is known as Gibb;s phenomenon. To
reduce these oscillations, the Fourier series coefficients are modified by multiplying a weighting sequence
called window [ ]w n ,
where1
2
12
0,for | |[ ] [ ]
0,for | |
N
N
nw n w n
n
= =
= >
After multiplication of window sequence [ ]w n with [ ]dh n , we get finite duration sequence [ ]h n , that
satisfies the desired magnitude response.1
2
12
[ ] [ ], for | |[ ]
0, for | |
N
N
dh n w n nh nn
=
>
The frequency response [ ] [ ] [ ]j j jdH e H e W e= .
The window must have the following Characteristics:i. The central lobe of the frequency response of the window should contain most of the energy and should
be narrow.
ii. The highest side lobe level of the frequency response should be small
iii. The side lobes of the frequency response should decrease in energy rapidly as tends to .
Various windowing techniques are illustrated below
-
7/29/2019 fwhomfbrhi27435FWHOMFBRHI
8/19
Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
8
(a)Rectangular Window:
The rectangular sequence is given by
1 12 2
1,for[ ]
0, elsewhere
N Nnw n
=
12
12
sin / 2[ ]
sin / 2
N
Nn
j jR
NW e e n
=
= =
i. For the rectangular window, the amplitude of the side lobes is unaffected by the length of the
window. So increase in length will not reduce the ripple but increase its frequency.
ii. J.W. Gibbs showed that a finite length LPF an 8.9% maximum ripple, no matter how long the filter is
made.
iii. The effect where maximum ripple occurs just before and after the transition band is known as Gibbs
phenomenon.
(b)Bartlett Window (Triangular Window): The N-point triangular window is given by
1 12 2
( 1) / 2
| |1 , for
[ ]0, elsewhere
N N
N
nn
w n
=
( )142
sin[ ]
sin / 2
Nj
T
W e
=
Advantage: The triangular window produces a smooth
magnitude response in both pass band and stop band.
Disadvantage: When compared to rectangular window
i. The transition region is more
ii. The attenuation in stop band is lessHence it is not a good choice.
(c)Hanning Window: The Hanning window is defined as
i. The main lobe width is twice of the rectangular window.
ii. The magnitude of the side lobe level is -31 dB, which is 18 dB lower that of rectangular window. That
is the first side lobe of Hanning window spectrum is 1/10 th of rectangular window.
iii. Smaller ripples in both pass band and stop band.
(d)Hamming Window: The Hamming window is defined as
1 12 2
( 1) / 20.54 0.46cos , for
[ ]
0, elsewhere
N N
N
nn
w n
+
=
1 12 2( 1) / 2
0.5 0.5cos , for[ ]
0, elsewhere
N N
N
nn
w n
+
=
-
7/29/2019 fwhomfbrhi27435FWHOMFBRHI
9/19
Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
9
i. The peak side lobe level is down about 41 dB from the main lobe peak an improvement 10dB relative
to the Hanning window.
ii. At higher frequencies the stop band attenuation is low when compared to that of Hanning window.
Because less oscillations in the side lobes than Hanning window the Hamming window is generally
preferred.
(e)Blackman Window: The Blackman window is defined as
1 12 2
( 1) / 2 ( 1) / 2
20.42 0.5cos 0.08cos ,for
[ ]
0, elsewhere
N N
N NB
n nn
w n
+ + =
The additional Cosine term reduces side lobes, but increases the
main lobe width to 12N
.
The peak side lobe level down about 57 dB from the main lobe peak, animprovement of 16dB relative to the Hamming window
The comparison of various windowing techniques are illustrated below
Comparison between FIR filters and IIR filters:
S.No FIR Filter IIR Filter
1These filters can be easily designed to have
perfectly linear phase,These filters dont have linear phase,
2
FIR filters can be realized recursively and non-
recursively, FIR filters are easily realized recursively ,
3Greater flexibility to control the shape of their
magnitude response,
Less flexibility, usually limited to specific kind
of filters.
4Errors due to round of noise are less severe in FIR
filters, mainly because feedback is not used.The round of noise in IIR filters is more.
-
7/29/2019 fwhomfbrhi27435FWHOMFBRHI
10/19
Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
10
Design Procedure for FIR Filters using Windows
Step1: From the given specifications draw the graph for [ ]jdH e in the range ( , ) .
Step2: Determine is impulse response using Inverse DTFT formula 12
[ ] [ ]j jnd dh n H e e d
= .
Step3: For the given order N
, determine ,[0] [1], [2]d d dh h h etc., using the following formulas.
For lim0
[0] [ ]d dnh h n
= or 1
2[0] [ ]jd dh H e d
= .
For [1], [2]d dh h . . . use the formula defined in Srep2.
Step4: Choose the appropriate window for the problem and write its equation for the given order N.
(a) Rectangular Window:1 1
2 21,
[ ]0,
N N
R
for nw n
elsewhere
=
(b) Bartlett Window:
1 1
2 2
| |
1 ,( 1) / 2[ ]
0,
N N
T
n
for nNw n
elsewhere
=
(c) Hanning Window:
1 12 2( 1)/2
0.5 0.5cos ,[ ]
0,
N NN
Hn
n for nw n
elsewhere
+ =
(d) Hamming Window:
1 12 2( 1)/2
0.54 0.46cos ,[ ]
0,
N NN
Hm
n for nw n
elsewhere
+ =
(e) Blackman window:
1 12 2( 1)/2 ( 1)/2
20.42 0.5 cos 0.08cos ,[ ]
0,
N NN N
B
n n for nw n
elsewhere
+ + =
Step5: After choosing appropriate window, determine the window coefficients [0], [1], [2]w w w for the order N.
Step6: Determine the filter coefficients according to the given window by using the formula
[ ] [ ] [ ]dh n h n w n= for Nvalues. i.e., [0], [ 1] [1], [ 2] [2]h h h h h = = etc.
Step7: Determine the transfer function using the formula { }
12
1
[ ] [0] [ ]
N
n
n nH z h h n z z
=
= + + .
Step8: Detrmine the realizable filter transfer function1
2[ ] [ ]N
H z H zz
= .
Step9: Determine the frequency response by substitutingj
ez = in [ ]H z calculated in step7.Step10: Formulate a table for a table for and 20log [ ]|j| H e and draw its magnitude response.
34
12
14
0 14 12
34
[ ]|j| H e
20log [ ]|j| H e
-
7/29/2019 fwhomfbrhi27435FWHOMFBRHI
11/19
Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
11
Ex2:Design an ideal LPF with a frequency response| |
2 2
| |2
1, for[ ]
0, for
jd
H e
=
. Find the values of
[ ]h n for 11N= . Find [ ]H z . Use various windows.
Ans: From ex1,
21
2
2
sin, for 5 5
[ ]0, Otherwise
d
nn
nh n
=
21 12 20 0
2
sin[0] lim [ ] limd dn n
nh h n
n
= = =
or 01 1 12
2 2 22
[0] [ ] 1c
c
j j
d h H e e d = d =
=
2 12
2 13
2 15
sin[ 1] [1] 0.3183
sin[ 2] [2] 0
2
sin3
[ 3] [3] 0.1063
sin2[ 4] [4] 0
4
sin5[ 5] [5] 0.06366
5
d d
d d
d d
d d
d d
h h
h h
h h
h h
h h
= = = =
= = =
= = = =
= = =
= = = =
(a) Rectangular Window:1 1
2 21,
[ ]0,
N N
R
for nw n
elsewhere
=
12
[ ] [ ] [ ]
[0] 1 [0] [0] [0]
[ 1] [1] 1 [ 1] [1] [1] [1] 0.3183
[ 2] [2] 1 [ 2] [2] [2] [2] 0
[ 3] [3] 1 [ 3] [3] [3] [3] 0.106
[ 4] [4] 1 [ 4] [4] [4] [4] 0
Rd
R Rd
R R Rd
R R Rd
R R Rd
R R Rd
R
h n h n w n
w h h w
w w h h h w
w w h h h w
w w h h h w
w w h h h w
w
=
= = = = = = = =
= = = = =
= = = = =
= = = = =
[ 5] [5] 1 [ 5] [5] [5] [5] 0.06366R Rdw h h h w = = = = =
(b) Bartlett Window:
1 12 2
1,[ ]
0,
N N
R
for nw n
elsewhere
=
| | | |[ ] 1 1 [ ] [ ] [ ]( 1) / 2 5
[0] 1 [0] [0] [0] 0.5
[ 1] [1] 0.8 [ 1] [1] [1] [1] 0.3183 0.8 0.25464
[ 2] [2] 0.6 [ 2] [2] [2] [2] 0 0.6 0
[ 3] [3] 0.4 [ 3] [3] [3]
T Td
T Td
T T Td
T T Td
T T d
n nw n h n h n w nN
w h h w
w w h h h w
w w h h h w
w w h h h w
= = == = =
= = = = = =
= = = = = =
= = = =
X
X
[3] 0.106 0.4 0.0424
[ 4] [4] 0.2 [ 4] [4] [4] [4] 0 0.2 0
[ 5] [5] 0 [ 5] [5] [5] [5] 0.06366 0 0
T
T T Td
T T Td
w w h h h w
w w h h h w
= =
= = = = = =
= = = = = =
X
X
X
-
7/29/2019 fwhomfbrhi27435FWHOMFBRHI
12/19
Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
12
(c) Hanning Window:
1 12 2( 1)/2
0.5 0.5cos ,[ ]
0,
N NN
Hn
n for nw n
elsewhere
+ =
5[ ] 0.5 0.5cos [ ] [ ] [ ]
[0] 1 [0] [0] [0] 1 0.5
[ 1] [1] 0.9045 [ 1] [1] [1] [1] 0.3183 0.9045 0.2879
[ 2] [2] 0.6545 [ 2] [2] [2] [2] 0 0.6545 0[ 3] [3] 0.
Hn Hn
Hn
Hn Hn Hn
Hn Hn Hn
Hn Hn
d
Td
d
d
nw n h n h n w n
w h h w
w w h h h w
w w h h h w
w w
= + =
= = =
= = = = = =
= = = = = = = =
X
X
X
3455 [ 3] [3] [3] [3] 0.106 0.3455 0.0366
[ 4] [4] 0.0955 [ 4] [4] [4] [4] 0 0.0955 0
[ 5] [5] 0 [ 5] [5] [5] [5] 0.06366 0 0
Hn
Hn Hn Hn
Hn Hn Hn
d
d
d
h h h w
w w h h h w
w w h h h w
= = = =
= = = = = =
= = = = = =
X
X
X
(d) Hamming Window:
1 12 2( 1)/2
0.54 0.46cos ,[ ]
0,
N NN
Hm
n for nw n
elsewhere
+ =
5[ ] 0.54 0.46cos [ ] [ ] [ ]
[0] 1 [0] [0] [0] 1 0.5
[ 1] [1] 0.9121 [ 1] [1] [1] [1] 0.3183 0.9121 0.2862[ 2] [2] 0.6821 [ 2] [2] [2] [2] 0 0.6821 0
[ 3] [3]
Hm
Hm
Hm Hm
Hm Hm
Hm Hm
Hmd
Hmd
Hmd
Hmd
nw n h n h n w n
w h h w
w w h h h ww w h h h w
w w
= + =
= = =
= = = = = = = = = = = =
=
X
XX
0.3979 [ 3] [3] [3] [3] 0.106 0.3979 0.0422
[ 4] [4] 0.1679 [ 4] [4] [4] [4] 0 0.1679 0
[ 5] [5] 0.080 [ 5] [5] [5] [5] 0.06366 0.080 0.0051Hm Hm
Hm Hm
Hmd
Hmd
Hmd
h h h w
w w h h h w
w w h h h w
= = = = =
= = = = = =
= = = = = =
X
X
X
(e) Blackman window:
1 12 2( 1)/2 ( 1)/2
20.42 0.5cos 0.08cos ,[ ]
0,
N NN N
B
n n for nw n
elsewhere
+ + =
5 52[ ] 0.42 0.5cos 0.08cos [ ] [ ] [ ][0] 1 [0] [0] [0] 1 0.5
[ 1] [1] 0.8942 [ 1] [1] [1] [1] 0.3183 0.8942 0.2846
[ 2] [2] 0.5098 [ 2] [2] [2] [2] 0 0.5098 0
[ 3] [3]
B B
B B
B B B
B B B
B B
d
d
d
d
n nw n h n h n w nw h h w
w w h h h w
w w h h h w
w w
= + + == = =
= = = = = =
= = = = = =
= =
X
X
X
0.2008 [ 3] [3] [3] [3] 0.106 0.2008 0.0213
[ 4] [4] 0.0402 [ 4] [4] [4] [4] 0 0.0402 0
[ 5] [5] 0 [ 5] [5] [5] [5] 0.06366 0 0
B
B B B
B B B
d
d
d
h h h w
w w h h h w
w w h h h w
= = = =
= = = = = =
= = = = = =
X
X
X
Ex3:Design a high pass filter to meet the following specifications: Cutoff frequency = 250 Hz, Sampling
frequency 1KHz. Filter length 7.
22
c
S
F
Fc
= = rad/sec
| |
2
1, for[ ]
0,jd
H e
else
=
2
2
1[ ] [ ]
21
1 12
sinsin 1
2
c
c
j jnd
jn jn-
h n H e e d
e d e d
n nc
n n
=
= +
= =
-
7/29/2019 fwhomfbrhi27435FWHOMFBRHI
13/19
Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
13
[0] 0.5; [ 1] [1] 0.3183; [ 2] [2] 0; [ 3] [3] 0.1061;d d d d d d d h h h h h h h= = = = = = =
{ }
12
1
[ ] [0] [ ]
N
n
n nH z h h n z z
=
= + + . The realizable filter transfer function1
2[ ] [ ]N
H z H zz
= .
Ex4: Design a Band Pass Filter with the following specifications:1 2
100Hz: 200Hzc cF F= = and
1KHzSF = . Filter length = 9.
Ans: 11
1002 2 0.2
1000SF
cc
F = = = and
22
2002 2 0.4
1000SF
cc
F = = =
1 2
2 1
1 1[ ] [ ] 1 1
2 2sin(0.4 ) sin(0.2 )
0.4 0.20.4 0.2
c c
c c
j jn jn jn
d
-
-h n H e e d e d e d
n n
n n
= = +
=
A suitable window function [ ]w n for 4 4n is computed and can be used to determine [ ] [ ] [ ]dh n h n w n= .
{ }
12
1
[ ] [0] [ ]
N
n
n nH z h h n z z
=
= + + . The realizable filter transfer function1
2[ ] [ ]N
H z H zz
= .
Ex5: Design a Band Stop Filter with the following specifications:1 2
100Hz: 200Hzc cF F= = and
1KHzSF = . Filter length = 9.
Ans: 11
1002 2 0.2
1000SF
cc
F = = = and
2
2
2002 2 0.4
1000SF
cc
F = = =
2 1
1 1
1[ ] [ ]
21
1 1 12
sin(0.2 ) sin(0.4 )[ ] 0.2 0.4
0.2 0.4
c c
c c
j jnd
jn jn jn
d
-
- -
h n H e e d
e d e d e d
n nh n
n n
=
= + +
=
-
7/29/2019 fwhomfbrhi27435FWHOMFBRHI
14/19
Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
14
Kaiser window: In previous sections, we discussed four different types of windows. The values of samples
of this windows depend only upon N, i.e., length of window. In other words, the width of the main lobe and
attenuation of side lobes depends only upon length N of window. They cannot controlled independently.
However, Kaiser window allows separate control of width of the main lobe and attenuation of side lobes. It
provides a large main lobe width for the given stop band attenuation, which implies the sharpest transition
width.
The Kaiser window is defined as
( )
[ ]
22
0 11 1
2 20
1
[ ] ,
0,
NN N
k
nI
w n for nI
elsewhere
=
where is an adjustable parameter, and [ ]0I x is the modified zeroth order Bessel function of the first
kind of order zero given by
[ ]2 2 2 2 3
0 2 2 21
21 0.25 (0.25 ) (0.25 )
1 1 . . .! 2 (1!) (2!) (3!)k
kx x x x
I xk=
= + = + + + +
Design: Consider the LPF specification shown in figure. Let the pass band
ripple and minimum stop band attenuation in decibels are given by
120log
1p
+=
and 20logS = respectively.
The transition width S pB = rad/sec and cutoff frequency
2
S pc
+= ., where p and S are pass band and stop band frequencies.
Design Steps:
Step1: Determine [ ]dh n using Inverse DTFT formula1
2[ ] [ ]j jnd dh n H e e d
= .
Use2
S pc
+=
Step2: Choose 1 2min( , ) = , where0.05
1 10 S = and
0.05
2 0.05
10 1
10 1
p
p
=
+.
Step3: Determine new stop band attenuation 20logS = .Step4: Determine the parameter from the following equation
0.4
0, 21
0.5842( 21) 0.07886( 21), 21 50
0.1102( 8.7), 50
S
S S S
S S
for
for
for
= + >
-
7/29/2019 fwhomfbrhi27435FWHOMFBRHI
15/19
Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
15
Step5: Choose the parameterD using equation
0.9222, 21
7.95, 21
14.36
S
SS
for
Dfor
= >
Step6: Choose the filter order for the lowest odd value ofNusing 1Sf D
NB
+ where Sf is
sampling frequency.Step7:Compute the window sequence
( )
[ ]
22
0 11 1
2 20
1
[ ] ,
0,
NN N
k
nI
w n for nI
elsewhere
=
Step8: Compute the modified impulse response using [ ] [ ] [ ]d kh n h n w n=
Step9: Determine the transfer function
12[ ] [ ]NH z H zz = , where { }
1
2
1
[ ] [0] [ ]
N
n
n nH z h h n z z
== + +
Ex6:Design an FIR filter satisfying the following specifications 0.1dBp ; 44.0dBS
20p = rad/sec; 30S = rad/sec; 100Sf = rad/sec;
Ans: From the given specifications 10S pB = = rad/sec; 252
S pc
+= = rad/sec;
2(Radians) 25
100 2c
= = ;
Step1: 1, | 20,
[ ] forjdelse
|H e
=
Then 2
2
sin1[ ]2
dnh n
n
= .
Step2: 0.05 0.05(44) 3X1 10 10 6.309 10S = = = , and
0.053X2 0.05
10 15.7563 10
10 1
p
p
= =+
3X1 2min( , ) 5.7563 10 = =
Step3: New 20log 44.797dBS = = .
Step4: For 44.797dBS = , 0.40.5842( 21) 0.07886( 21) 3.9524S S = + = .
Step5: For 44.797dBS = ,7.95
2.56614.36
SD
= = .
Step6: 100(2.566)1 1 26.6610
Sf DNB
+ = + = . 27N = .
Step7:
( )
[ ]
22
0 1
0
1
[ ] , 13 13N
k
nI
w n for nI
=
For 3.9524 = , [ ] 10.73790I =
-
7/29/2019 fwhomfbrhi27435FWHOMFBRHI
16/19
Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
16
[ ][ ]
[ ]
[ ]
[ ][ ]
0[0] 1
03.9406 10.73790[ 1] [1] 0.9899
10.8468 10.84683.9073 10.41630[ 2] [2] 0.9603
10.8468 10.84683.8457
9.89640[ 3] [3] 0.912410.8468 10.8468
3.7606 9.20180[ 4] [4]10.8468 10
Iwk I
Iw wk k
Iw wk k
Iw wk k
Iw wk k
= =
= = = =
= = = =
= = = =
= = =
[ ]
[ ]
[ ]
[ ]
0.84835.8468
3.623 8.18560[ 5] [5] 0.7546510.8468 10.8468
3.5062 7.41680[ 6] [6] 0.6837810.8468 10.8468
3.3305 6.40250[ 7] [7] 0.5902710.8468 10.8468
3.1154 5.36130[ 8] [8]
10.8468 10.
Iw wk k
Iw wk k
Iw wk k
Iw w
k k
=
= = = =
= = = =
= = = =
= = =
[ ]
[ ]
[ ]
0.49428
84682.852 4.33310[ 9] [9] 0.399510.8468 10.8468
2.5257 3.35530[ 10] [10] 0.3093410.8468 10.8468
2.1063 2.45740[ 11] [11] 0.226510.8468 10.8468
[1.52] 1.66660[ 12] [12]10.8468
Iw wk k
Iw wk k
Iw wk k
Iw wk k
=
= = = =
= = = =
= = = =
= = =
[ ]
0.153610.8468
0 10[ 13] [13] 0.092210.8468 10.8468
Iw wk k
=
= = = =
The impulse response are given belown [ ]dh n [ ] [ ] [ ]dh n h n w nk=
0 0.5 0.5
1 0.318 0.31479
2 0 0
3 -0.106 -0.0967
4 0 0
5 0.06366 0.4804
6 0 0
7 -0.0454 -0.0268
8 0 0
9 0.03536 0.01412610 0 0
11 -0.0289 -0.006546
12 0 0
13 0.02448 0.002267
The Transfer function is given by1
2[ ] [ ]N
H z H zz
= , where { }
12
1
[ ] [0] [ ]
N
n
n nH z h h n z z
=
= + +
-
7/29/2019 fwhomfbrhi27435FWHOMFBRHI
17/19
Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
17
Solved Problems:
Ex7:Designa a LPF with the following specifications2 , |
4
0,[ ]
j forjd
else
e |H e
=
.
Ans: For the given specifications of a LPF with4c
= , 2j e indicates the delay of 2 units. This implies
12
2
N = or 5N= (Filter length).
Method 1: The filter length of 5 has been reinforced by defining rectangular window function for 0 4n .It is to be noted that [ ] [ ] [ ]dh n h n w n= and in this case both [ ]dh n and [ ]w n are defined with the view of
obtaining a causal filter directly, unlike in the previous examples where we first obtained [ ]h n
for 1 12 2
N Nn and then causilised [ ]h n by right shift so that [ ] 0h n = for 0n < .
Now
2
4
4
1 1[ ] [ ]
2 2sin ( 2)1
24 ( 2)
c
c
j jn j jn
d d h n H e e d e e d
nn
n
= =
=
1[2] 0.25
4dh = = ,
[0] [4] 0.15923d dh h= = and
[1] [3] 0 .22519d dh h= =
For rectangular window,
[0] [1] [2] [3] [5] 1R R R R Rw w w w w= = = = =
and [ ] [ ] [ ]dh n h n w n=
[0] [4] [0] [0] 0.15923
[1] [3] [1] [1] 0.22519[ ] [2] [2] 0.25
Rd
RdRd
h h h w
h h h wh n h w
= = =
= = =
= =
1 4
0 0
[ ] [ ] [ ]N
n n
n nH z h n z h n z
= =
= =
1 2 3 4
1 2 3 4
[0] [1] [2] [3] [4]
0.15923 0.22519 0.25 0.22519 0.15923
h h z h z h z h z
z z z z
= + + + +
= + + + +
For Hamming window: defined for 1 12 2
N Nn
1 12 2( 1)/2
2
[ ] 0.54 0.46 cos ,
0.54 0.46 cos , 2 2
N NHm N
nw n for n
n for n
= +
= +
[0] 1; [ 1] [1] 0.5400; [ 2] [2] 0.0800Hm Hm Hm Hm Hmw w w w w= = = = =
Causal Hamming window coefficients are given by' ' ' ' '[2] 1; [0] [4] 0.0800; [1] [3] 0.5400Hm Hm Hm Hm Hmw w w w w= = = = =
Then '[ ] [ ] [ ]Hmdh n h n w n=
'
'
'
[2] [2] [2] 1 2.5 0.25
[0] [4] [0] [0] 0.0800 0.15923 0.01274
[1] [3] [1] [1] 0.22519 0.5400 0.1216
Hmd
Hmd
Hmd
h h w
h h h w
h h h w
= = =
= = = =
= = = =
X
X
X
-
7/29/2019 fwhomfbrhi27435FWHOMFBRHI
18/19
Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
18
1 41 2 3 4
0 01 2 3 4
[ ] [ ] [ ] [0] [1] [2] [3] [4]
0.01274 0.1216 0.25 0.1216 0.01274
N
n n
n nH z h n z h n z h h z h z h z h z
z z z z
= =
= = = + + + +
= + + + +
Method 2: Use Causal Hamming window defined as
( 1)/2
2
00.54 0.46cos
0.54 0.46cos
[ ] ,
4,
1
0NHm
w n for
f
n n Nn or n
=
=
[2] 1;[0] [4] 0.0800;[1] [3] 0.5400
Hm
Hm Hm
Hm Hm
ww ww w
== == =
which are equivalent to ' [ ]Hmw n calculated in method1.
1 41 2 3 4
0 0
[2] [2] [2] 1 2.5 0.25
[0] [4] [0] [0] 0.0800 0.15923 0.01274
[1] [3] [1] [1] 0.22519 0.5400 0.1216
[ ] [ ] [ ] [0] [1] [2] [3] [4]
0.01274 0.1216
Hm
Hm
Hm
d
d
dN
n n
h h w
h h h w
h h h w
n nH z h n z h n z h h z h z h z h z
z
= =
= = =
= = = =
= = = =
= = = + + + +
= +
X
X
X
1 2 3 40.25 0.1216 0.01274z z z + + +
Method 3: Consider the magnitude function as , |4
| [ ] 1|j fordH e |= and design the filter in usual
procedure. The phase information is useful in determining the filter length.
4
4
1 1[ ] [ ] 1
2 2sin1
4
c
c
j jn jn
d d h n H e e d e d
n
n
= =
=
[0] 0.25[ 1] [1] 0.2251[ 2] [2] 0.1592
d
d d
d d
hh hh h
= = = = =
For Hamming window: defined for 1 12 2
N Nn
1 12 2( 1)/2
2
[ ] 0.54 0.46 cos ,
0.54 0.46 cos , 2 2
N NHm N
nw n for nn for n
= +
= +
[0] 1; [ 1] [1] 0.5400; [ 2] [2] 0.0800Hm Hm Hm Hm Hmw w w w w= = = = =
Then [ ] [ ] [ ]Hmdh n h n w n=
122
1 01 2 2
[0] [0] [0] 1 2.5 0.25
[ 1] [1] [1] [1] 0.22519 0.5400 0.1216
[ 2] [2] [1] [1] 0.0800 0.15923 0.01274
[ ] [0] [ ]{ } [ ]{ }
[0] [1]( ) [2]( )
0.25
Hm
Hm
Hm
d
d
dN
n n
h h w
h h h w
h h h w
n n n nH z h h n z z h n z z
h h z z h z z
= =
= = =
= = = =
= = = =
= + + = +
= + + + += +
X
X
X
1 2 20.1216 0.1216 0.01274 0.01274z z z z + + +
The realizable filter1
2 2[ ] [ ] [ ]N
H z H z H zz z = = .
-
7/29/2019 fwhomfbrhi27435FWHOMFBRHI
19/19
Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
19
( )1 2 21 2 3 4
2 2[ ] [ ] 0.25 0.1216 0.1216 0.01274 0.01274
0.01274 0.1216 0.25 0.1216 0.01274
H z H z z z z z
z z z z
z z
= = + + + += + + + +
Observe that All three methods gives the same results.
The Causal window function are given below
Hanning:( 1)/2
0.5 0.5 co 0 1,s[ ]n NHnw n f n Nor= .
Hamming:( 1)/2
0.54 0.46c[ ] ,os 0 1H Nm nn Nnw for = .
Bartlett:( 1)/2 ( 1
1) 2/
122
20.42 0.5 cos 0.08[ ] ,cosN
NB N
Nw n fon nn r + = .
Ex8: Design a linear phase FIR filter using Hamming and Hanning windows for the following desired
frequency response3 , |
4
0,[ ]
j forjd
else
e |H e
=
.
Ans: This is a HPF with cut-off frequency4
c
= and1
3 72
NN
= = .
3 3
4
1 1[ ] [ ]2 2
sin ( 3)
( 3)
cc
j jn j jn j jnd d
h n H e e d e e d e e d
n
n n
= =
=
[3] 0.75
[0] [6] 0.07506
[1] [5] 0.15923
[2] [4] 0.22586
d
d d
d d
d d
h
h h
h h
h h
=
= =
= =
= =
For Hanning window:3
0.5 0.5c[ ] 0 6os ,Hn
nw n for n=
[3] 1
[0] [6] 0
[1] [5] 0.25
[2] [4] 0.75
Hn
Hn Hn
Hn Hn
Hn Hn
w
w w
w w
w w
=
= =
= =
= =
Now [ ] [ ] [ ] { 0, 0.0398, 0.16939,0.75, 0.16939, 0.0398,0 }Hmdh n h n w n
= =
Causal 1 2 3 4 5[ ] 0.0398 0.16939 0.75 0.16939 0.0398H z z z z z z = +
For Hamming window:3
0.54 0.46[ ] 0 6os ,cHmnw n for n=
[3] 1
[0] [6] 0.08
[1] [5] 0.31
[2] [4] 0.77
Hm
Hm Hm
Hm Hm
Hm Hm
w
w w
w w
w w
=
= =
= =
= =
Now [ ] [ ] [ ] { 0.006, 0.04936, 0.17391,0.75, 0.17396, 0.04936, 0.006 }Hndh n h n w n
= =
Causal 1 2 3 4 5 6[ ] 0.006 0.04936 0.17391 0.75 0.17396 0.04936 0.006H z z z z z z z = +