Вы находитесь на странице: 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. The
advantages 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.

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]
[ ]
. . .
N
N
k
k
y n b x n b x n b x n N
b x n k

=
= + + +
=
+

(1)
where
k
b 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 n z z

=
=

(3)
which we view as a polynomial of degree 1 N in the variable
1
z

. The roots of this polynomial constitute


the zeros of the filter.
The frequency response of the filter is obtained by substituting
j
z e = in equation (3), thus we get
1
0
[ ] [ ]
N
j jn
n
H h n e 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 e e e

= (5)
where | [ ] |
j
H 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

g
d
= . (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
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 write
1
[ ]
0
[ ] | [ ] |
N
jn j j
n
h n H e e e

=
=

or

1
0
[ ]{cos sin } | [ ] | {cos [ ] sin [ ]}
N
j
n
h n n j n H j e

=
= +

(9)
which gives us
1
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
0
1
0
[ ] sin
| [ ] | sin [ ] sin [ ] sin( ) sin( )
cos [ ] cos( ) cos( ) | [ ] | cos [ ]
[ ] cos
N
j
n
j N
n
h n n
H
H
h n n
e
e


= = = =


After cross multiplying and simplifying we get

1
0
[ ] sin ( ) 0
N
n
h n n

=
=

(10)
The above equation is zero when [ ] [ 1 ] h n h N n = and
1
2
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).



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
j
k
n
H e h h k n n
=
= +

and [
j
H e k = , where
1
2
N
k

= .
1
| [ ] | [ ] 2 [ ]cos ,
k
j
k
n
H e h h k n n
=
= +

and [ ]
j
H e k = , where
1
2
N
k

= .
Applications: L.P.F., H.P.H., B.P.F., and B.R.F
Case 2: Symmetrical Impulse Response and N is even:

/2
1
2
1
2
| [ ] | 2 [ ]cos )
N
j
n
N
H e h n ( n
=
=

and
( )
1
2
[ ]
j N
H e

=
Applications: L.P.F., and B.P.F
Case 3: Anti-symmetrical Impulse Response and N is odd:

1
2
1
1
2
| [ ] | 2 [ ]sin
N
j
n
N
H e h n n

=

=

and
( )
1
2 2
[ ]
j N
H e

=
Applications: Differentiator and Hilbert Transform.
Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
5

Case 4: Anti-symmetrical Impulse Response and N is even:

2
)
1
2 2
1
| [ ] | 2 [ ]sin
N
j N
n
H e h n (n - n
=
=

and
( )
1
2 2
[ ]
j N
H e

=
Applications: Differentiator and Hilbert Transform.
Designing FIR Filters:
Fourier Series Method: The frequency response [ ]
j
H 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 jn
d
n
H e h n e

=
=

where
1
2
[ ] [ ]
j jn
d
h n H e e d


=

.
The Z.T. of sequence is, [ ] [ ]
n
d
n
H z h n z

=
=

which is an infinite duration sequence. To get FIR filter
transfer function the series can be truncated by assigning [ ] [ ]
d
h n h n = for
1 1
2 2
N N
n

. That is

1 1
2 2
[ ], for
[ ]
0, Otherwise
d
N N
n h n
h n

. Then
( ) ( )
| |
1
1 1 2
2 2
1
2
1
2
1 1
1
1 1
2 2
[ ] [ ] . . . . ( 1) (0) (1) . . .
(0) [ ] [ ]
N
N N
N
N
n
n
n n
n
N N
H 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 0 n = . That is [ ] [ ] h n h n = .
Therefore
| |
1
2
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 by
1
2
N
z

, where
1
2
N
is the delay in samples.
Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
6

Therefore the physically realizable filter transfer function can be written as

| |
1
2
1
1 2
2
1
[ ] [ ]
(0) [ ]
N
N
N
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
j
d

H e

. Find the values of


[ ] h n for 11 N = . Find [ ] H z and plot its response. Use Fourier series method.
Solution:
1 1
2 2
2 1 1
2 2
2
[ ] [ ] [ ]
sin
sin
1.
c
c
c
c

j jn j jn
d

c
jn

h n H e e d= H e e d
n
n
= e d= n
n n

=
=


Given that 11 N = . Therefore
1 11 1
2 2
5
N
n

= = = .

2 1
2
2
sin
, for 5 5
[ ]
0, Otherwise
d
n
n
n h n


2 1 1
2 2
0 0
2
sin
[0] lim [ ] lim
d d
n n
n
h h n
n


(
= = = (
(

(

or
0 1 1 1 2
2 2 2
2
[0] [ ] 1
c
c

j j
d

h H e e d= d=



=


2 1
2
2 1
3
2 1
5
sin
[ 1] [1] 0.3183
sin
[ 2] [2] 0
2
sin3
[ 3] [3] 0.106
3
sin 2
[ 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

= = = =
= = =
= = = =
= = =
= = = =

The transfer function of the filter
| | | |
1
2
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


= =

= + + = = + +
= + + + + +


Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
7

The transfer function of realizable filter
1
2
[ ] [ ]
N
H z z H z


1
5
2
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
j
z 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
d
H 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 ,
where
1
2
1
2
0, for | |
[ ] [ ]
0, for | |
N
N
n
w n w n
n


= =

= >


After multiplication of window sequence [ ] w n with [ ]
d
h n , we get finite duration sequence [ ] h n , that
satisfies the desired magnitude response.

1
2
1
2
[ ] [ ], for | |
[ ]
0, for | |
N
N
d
h n w n n
h n
n


=

>


The frequency response [ ] [ ] [ ]
j j j
d
H 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

Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
8

(a) Rectangular Window:
The rectangular sequence is given by

1 1
2 2
1, for
[ ]
0, elsewhere
N N
n
w n


=


1
2
1
2
sin / 2
[ ]
sin / 2
N
N
n
j j
R
N
W 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 1
2 2
( 1) / 2
| |
1 , for
[ ]
0, elsewhere
N N
N
n
n
w n


( )
1
4
2
sin
[ ]
sin / 2
N
j
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 less
Hence 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 1
2 2
( 1) / 2
0.54 0.46cos , for
[ ]
0, elsewhere
N N
N
n
n
w n


1 1
2 2
( 1) / 2
0.5 0.5cos , for
[ ]
0, elsewhere
N N
N
n
n
w n

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 1
2 2
( 1) / 2 ( 1) / 2
2
0.42 0.5cos 0.08cos ,for
[ ]
0, elsewhere
N N
N N
B
n n
n
w n

+ +


The additional Cosine term reduces side lobes, but increases the
main lobe width to
12
N

.
The peak side lobe level down about 57 dB from the main lobe peak, an
improvement 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
1
These 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 ,
3
Greater flexibility to control the shape of their
magnitude response,
Less flexibility, usually limited to specific kind
of filters.
4
Errors 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.


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 [ ]
j
d
H e

in the range ( , ) .
Step2: Determine is impulse response using Inverse DTFT formula
1
2
[ ] [ ]
j jn
d d
h n H e e d


=

.
Step3: For the given order N, determine , [0] [1], [2]
d d d
h h h etc., using the following formulas.
For lim
0
[0] [ ]
d d
n
h h n

= or
1
2
[0] [ ]
j
d d
h H e d


=

.
For [1], [2]
d d
h 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 2
1,
[ ]
0,
N N
R
for n
w n
elsewhere


=


(b) Bartlett Window:
1 1
2 2
| |
1 ,
( 1) / 2 [ ]
0,
N N
T
n
for n
N w n
elsewhere


(c) Hanning Window:
1 1
2 2 ( 1)/2
0.5 0.5cos ,
[ ]
0,
N N
N
Hn
n
for n
w n
elsewhere


(d) Hamming Window:
1 1
2 2 ( 1)/2
0.54 0.46cos ,
[ ]
0,
N N
N
Hm
n
for n
w n
elsewhere


(e) Blackman window:
1 1
2 2 ( 1)/2 ( 1)/2
2
0.42 0.5cos 0.08cos ,
[ ]
0,
N N
N N
B
n n
for n
w 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
[ ] [ ] [ ]
d
h n h n w n = for N values. i.e., [0], [ 1] [1], [ 2] [2] h h h h h = = etc.
Step7: Determine the transfer function using the formula { }
1
2
1
[ ] [0] [ ]
N
n
n n
H z h h n z z

=

= + +

.
Step8: Detrmine the realizable filter transfer function
1
2
[ ] [ ]
N
H z H z z

.
Step9: Determine the frequency response by substituting
j
e z = in [ ] H z calculated in step7.
Step10: Formulate a table for a table for and 20log [ ]|
j
| H e and draw its magnitude response.


3
4

1
2

1
4
0
1
4

1
2

3
4

[ ]|
j
| H e

20log [ ]|
j
| H e

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
j
d

H e

. Find the values of


[ ] h n for 11 N = . Find [ ] H z . Use various windows.
Ans: From ex1,

2 1
2
2
sin
, for 5 5
[ ]
0, Otherwise
d
n
n
n h n


2 1 1
2 2
0 0
2
sin
[0] lim [ ] lim
d d
n n
n
h h n
n


(
= = = (
(

(

or
0 1 1 1 2
2 2 2
2
[0] [ ] 1
c
c

j j
d

h H e e d= d=



=


2 1
2
2 1
3
2 1
5
sin
[ 1] [1] 0.3183
sin
[ 2] [2] 0
2
sin3
[ 3] [3] 0.106
3
sin 2
[ 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 2
1,
[ ]
0,
N N
R
for n
w n
elsewhere


=


1
2
[ ] [ ] [ ]
[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
R d
R R d
R R R d
R R R d
R R R d
R R R d
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.06366
R R d
w h h h w = = = = =

(b) Bartlett Window:

1 1
2 2
1,
[ ]
0,
N N
R
for n
w 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 T d
T T d
T T T d
T T T d
T T d
n n
w n h n h n w n
N
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 T d
T T T d
w w h h h w
w w h h h w
= =
= = = = = =
= = = = = =
X
X
X

Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
12

(c) Hanning Window:
1 1
2 2 ( 1)/2
0.5 0.5cos ,
[ ]
0,
N N
N
Hn
n
for n
w 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
T d
d
d
n
w 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 1
2 2 ( 1)/2
0.54 0.46cos ,
[ ]
0,
N N
N
Hm
n
for n
w 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
Hm d
Hm d
Hm d
Hm d
n
w 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
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.0051
Hm Hm
Hm Hm
Hm d
Hm d
Hm d
h h h w
w w h h h w
w w h h h w
= = = = =
= = = = = =
= = = = = =
X
X
X

(e) Blackman window:
1 1
2 2 ( 1)/2 ( 1)/2
2
0.42 0.5cos 0.08cos ,
[ ]
0,
N N
N N
B
n n
for n
w n
elsewhere

+ +



5 5
2
[ ] 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 n
w 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
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.
2
2
c
S
F
F
c


= = rad/sec
| |
2
1, for
[ ]
0,
j
d

H e
else



2
2
1
[ ] [ ]
2
1
1 1
2
sin
sin 1
2
c
c
j jn
d
jn jn
-

h n H e e d
e d e d
n
n
c
n n

=

(
= +
(

= =



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 = = = = = = =
{ }
1
2
1
[ ] [0] [ ]
N
n
n n
H z h h n z z

=

= + +

. The realizable filter transfer function


1
2
[ ] [ ]
N
H z H z z

.
Ex4: Design a Band Pass Filter with the following specifications:
1 2
100Hz: 200Hz
c c
F F = = and
1KHz
S
F = . Filter length = 9.
Ans:
1
1
100
2 2 0.2
1000
S
F
c
c
F
= = = and

2
2
200
2 2 0.4
1000
S
F
c
c
F
= = =
1 2
2 1
1 1
[ ] [ ] 1 1
2 2
sin(0.4 ) sin(0.2 )
0.4 0.2
0.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 4 n is computed and can be used to determine [ ] [ ] [ ]
d
h n h n w n =
.

{ }
1
2
1
[ ] [0] [ ]
N
n
n n
H z h h n z z

=

= + +

. The realizable filter transfer function


1
2
[ ] [ ]
N
H z H z z

.

Ex5: Design a Band Stop Filter with the following specifications:
1 2
100Hz: 200Hz
c c
F F = = and
1KHz
S
F = . Filter length = 9.
Ans:
1
1
100
2 2 0.2
1000
S
F
c
c
F
= = = and

2
2
200
2 2 0.4
1000
S
F
c
c
F
= = =
2 1
1 1
1
[ ] [ ]
2
1
1 1 1
2
sin(0.2 ) sin(0.4 )
[ ] 0.2 0.4
0.2 0.4
c c
c c
j jn
d

jn jn jn

d
-
- -
h n H e e d
e d e d e d
n n
h n
n n



=

(
= + +
(

=











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

( )
| |
2
2
0
1
1 1
2 2
0
1
[ ] ,
0,
N
N N
k
n
I
w n for n
I
elsewhere


where is an adjustable parameter, and
| |
0
I 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 2
1
2
1 0.25 (0.25 ) (0.25 )
1 1 . . .
! 2 (1!) (2!) (3!)
k
k
x x x x
I x
k
=
(
| |
( = + = + + + +
|
( \ .



Design: Consider the LPF specification shown in figure. Let the pass band
ripple and minimum stop band attenuation in decibels are given by
1
20log
1
p

+
=

and 20log
S
= respectively.
The transition width
S p
B = rad/sec and cutoff frequency
2
S p
c

+
= ., where
p
and
S
are pass band and stop band frequencies.
Design Steps:
Step1: Determine [ ]
d
h n using Inverse DTFT formula
1
2
[ ] [ ]
j jn
d d
h n H e e d


=

.
Use
2
S p
c

+
=
Step2: Choose
1 2
min( , ) = , where
0.05
1
10
S


= and
0.05
2
0.05
10 1
10 1
p
p


=
+
.
Step3: Determine new stop band attenuation 20log
S
= .
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

= +

>




Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
15

Step5: Choose the parameter D using equation

0.9222, 21
7.95
, 21
14.36
S
S
S
for
D
for

=

>


Step6: Choose the filter order for the lowest odd value of N using 1
Sf
D
N
B
+ where
Sf
is
sampling frequency.
Step7:Compute the window sequence

( )
| |
2
2
0
1
1 1
2 2
0
1
[ ] ,
0,
N
N N
k
n
I
w n for n
I
elsewhere


Step8: Compute the modified impulse response using [ ] [ ] [ ]
d k
h n h n w n =
Step9: Determine the transfer function

1
2
[ ] [ ]
N
H z H z z

, where { }
1
2
1
[ ] [0] [ ]
N
n
n n
H z h h n z z

=

= + +



Ex6:Design an FIR filter satisfying the following specifications 0.1dB
p
; 44.0dB
S

20
p
= rad/sec; 30
S
= rad/sec; 100
Sf
= rad/sec;
Ans: From the given specifications 10
S p
B = = rad/sec; 25
2
S p
c

+
= = rad/sec;

2
(Radians) 25
100 2
c


= = ;
Step1:
1, |
2
0,
[ ]
for
j
d
else
|
H e

Then
2
2
sin
1
[ ]
2
d
n
h n
n

= .
Step2:
0.05 0.05(44) 3
X
1
10 10 6.309 10
S


= = = , and
0.05
3
X
2
0.05
10 1
5.7563 10
10 1
p
p


= =
+


3
X
1 2
min( , ) 5.7563 10

= =
Step3: New 20log 44.797dB
S
= = .
Step4: For 44.797dB
S
= ,
0.4
0.5842( 21) 0.07886( 21) 3.9524
S S
= + = .
Step5: For 44.797dB
S
= ,
7.95
2.566
14.36
S
D

= = .
Step6:
100(2.566)
1 1 26.66
10
Sf
D
N
B
+ = + = . 27 N = .
Step7:

( )
| |
2
2
0
1
0
1
[ ] , 13 13
N
k
n
I
w n for n
I

(

=
For 3.9524 = , | | 10.7379
0
I =
Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
16

| |
| |
| |
| |
| |
| |
0
[0] 1
0
3.9406
10.7379
0
[ 1] [1] 0.9899
10.8468 10.8468
3.9073
10.4163
0
[ 2] [2] 0.9603
10.8468 10.8468
3.8457
9.8964
0
[ 3] [3] 0.9124
10.8468 10.8468
3.7606
9.2018
0
[ 4] [4]
10.8468 10
I
w
k
I
I
w w
k k
I
w w
k k
I
w w
k k
I
w w
k k

= =
= = = =
= = = =
= = = =
= = =
| |
| |
| |
| |
0.84835
.8468
3.623
8.1856
0
[ 5] [5] 0.75465
10.8468 10.8468
3.5062
7.4168
0
[ 6] [6] 0.68378
10.8468 10.8468
3.3305
6.4025
0
[ 7] [7] 0.59027
10.8468 10.8468
3.1154
5.3613
0
[ 8] [8]
10.8468 10.
I
w w
k k
I
w w
k k
I
w w
k k
I
w w
k k
=
= = = =
= = = =
= = = =
= = =
| |
| |
| |
0.49428
8468
2.852
4.3331
0
[ 9] [9] 0.3995
10.8468 10.8468
2.5257
3.3553
0
[ 10] [10] 0.30934
10.8468 10.8468
2.1063
2.4574
0
[ 11] [11] 0.2265
10.8468 10.8468
[1.52]
1.6666
0
[ 12] [12]
10.8468
I
w w
k k
I
w w
k k
I
w w
k k
I
w w
k k
=
= = = =
= = = =
= = = =
= = =
| |
0.1536
10.8468
0
1
0
[ 13] [13] 0.0922
10.8468 10.8468
I
w w
k k
=
= = = =

The impulse response are given below
n
[ ]
d
h n [ ] [ ] [ ]
d
h n h n w n
k
=
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.014126
10 0 0
11 -0.0289 -0.006546
12 0 0
13 0.02448 0.002267
The Transfer function is given by
1
2
[ ] [ ]
N
H z H z z

, where { }
1
2
1
[ ] [0] [ ]
N
n
n n
H z h h n z z

=

= + +


Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
17

Solved Problems:
Ex7:Designa a LPF with the following specifications
2
, |
4
0,
[ ]
j
for
j
d
else
e |
H e


=

.
Ans: For the given specifications of a LPF with
4
c


= ,
2 j
e

indicates the delay of 2 units. This implies


1
2
2
N
= or 5 N = (Filter length).
Method 1: The filter length of 5 has been reinforced by defining rectangular window function for 0 4 n .
It is to be noted that [ ] [ ] [ ]
d
h n h n w n = and in this case both [ ]
d
h 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 1
2 2
N N
n

and then causilised [ ] h n by right shift so that [ ] 0 h n = for 0 n < .
Now
2
4
4
1 1
[ ] [ ]
2 2
sin ( 2)
1
2
4 ( 2)
c
c

j jn j jn
d d

h n H e e d e e d
n
n
n




= =
| |
= |
|

\ .


1
[2] 0.25
4
d
h = = ,
[0] [4] 0.15923
d d
h h = = and
[1] [3] 0.22519
d d
h h = =
For rectangular window,
[0] [1] [2] [3] [5] 1
R R R R R
w w w w w = = = = =
and [ ] [ ] [ ]
d
h n h n w n =
[0] [4] [0] [0] 0.15923
[1] [3] [1] [1] 0.22519
[ ] [2] [2] 0.25
R d
R d
R d
h h h w
h h h w
h n h w
= = =
= = =
= =

1 4
0 0
[ ] [ ] [ ]
N
n n
n n
H 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 1
2 2
N N
n



1 1
2 2 ( 1)/2
2
[ ] 0.54 0.46cos ,
0.54 0.46cos , 2 2
N N
Hm
N
n
w n for n
n
for n

= +
= +

[0] 1; [ 1] [1] 0.5400; [ 2] [2] 0.0800
Hm Hm Hm Hm Hm
w w w w w = = = = =
Causal Hamming window coefficients are given by
' ' ' ' '
[2] 1; [0] [4] 0.0800; [1] [3] 0.5400
Hm Hm Hm Hm Hm
w w w w w = = = = =
Then
'
[ ] [ ] [ ]
Hm d
h 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
Hm d
Hm d
Hm d
h h w
h h h w
h h h w
= = =
= = = =
= = = =
X
X
X

Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
18

1 4
1 2 3 4
0 0
1 2 3 4
[ ] [ ] [ ] [0] [1] [2] [3] [4]
0.01274 0.1216 0.25 0.1216 0.01274
N
n n
n n
H 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
0 0.54 0.46cos
0.54 0.46cos
[ ] ,
4 ,
1
0
N
Hm
w n for
f
n
n N
n
or n


[2] 1;
[0] [4] 0.0800;
[1] [3] 0.5400
Hm
Hm Hm
Hm Hm
w
w w
w w
=
= =
= =
which are equivalent to
'
[ ]
Hm
w n calculated in method1.
1 4
1 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
d
N
n n
h h w
h h h w
h h h w
n n
H z h n z h n z h h z h z h z h z
z


= =

= = =
= = = =
= = = =

= = = + + + +
= +

X
X
X
1 2 3 4
0.25 0.1216 0.01274 z z z

+ + +


Method 3: Consider the magnitude function as , |
4
| [ ] 1|
j
for
d
H e |

= and design the filter in usual
procedure. The phase information is useful in determining the filter length.

4
4
1 1
[ ] [ ] 1
2 2
sin
1
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
h
h h
h h
=
= =
= =

For Hamming window: defined for
1 1
2 2
N N
n



1 1
2 2 ( 1)/2
2
[ ] 0.54 0.46cos ,
0.54 0.46cos , 2 2
N N
Hm
N
n
w n for n
n
for n

= +
= +

[0] 1; [ 1] [1] 0.5400; [ 2] [2] 0.0800
Hm Hm Hm Hm Hm
w w w w w = = = = =
Then [ ] [ ] [ ]
Hm d
h n h n w n =
1
2 2
1 0
1 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
d
N
n n
h h w
h h h w
h h h w
n n n n
H z h h n z z h n z z
h h z z h z z

= =

= = =
= = = =
= = = =

= + + = +
= + + + +
= +

X
X
X
1 2 2
0.1216 0.1216 0.01274 0.01274 z z z z

+ + +

The realizable filter
1
2
2
[ ] [ ] [ ]
N
H z H z H z z z


= =

.
Dr. M. Venu Gopala Rao, Professor, KL University, Vijayawada
19

( )
1 2 2
1 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.5co 0 1 , s [ ]
n
N
H
n
w n f n N or

= .
Hamming:
( 1)/2
0.54 0.46c [ ] , os 0 1
H
N
m
n n N
n
w for

= .
Bartlett:
( 1)/2 ( 1
1
) 2 /
1
2 2
2
0.42 0.5cos 0.08 [ ] , cos
N
N
B
N
N
w n fo
n
n
n
r



+ = .

Ex8: Design a linear phase FIR filter using Hamming and Hanning windows for the following desired
frequency response
3
, |
4
0,
[ ]
j
for
j
d
else
e |
H e

.
Ans: This is a HPF with cut-off frequency
4
c


= and
1
3 7
2
N
N

= = .

3 3
4
1 1
[ ] [ ]
2 2
sin ( 3)
( 3)
c
c

j jn j jn j jn
d 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 6 os ,
Hn
n
w 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}
Hm d
h n h n w n

= =
Causal
1 2 3 4 5
[ ] 0.0398 0.16939 0.75 0.16939 0.0398 H z z z z z z

= +
For Hamming window:
3
0.54 0.46 [ ] 0 6 os , c
Hm
n
w 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}
Hn d
h 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.006 H z z z z z z z

= +

Вам также может понравиться