Designing FIR Filters Explained
Designing FIR Filters Explained
FIR Filters
6.1 Introduction
The filters are frequency selective devices. An LTI system performs a type of discrimination or
filtering among the various frequency components at its input. The nature of this filtering action is determined
by the frequency response characteristic H(ejw ), which in turn depends on the choice of the system parameters
[e.g., the coefficients ak and bk in the difference equation governing the system]. Thus by proper selection
of the coefficients, we can design frequency selective filters that pass signals with frequency components
in some bands while they attenuate signals that contain frequency components in other frequency bands.
In general, the specification of a digital filter will be desired frequency response, Hd(ejw ). The desired
impulse response, hd(n) of the digital filter can be obtained by taking inverse Fourier transform of Hd(ejw ). Now,
the hd(n) will be an infinite duration discrete time signal defined for all values of n in the range – ¥ to +¥ .
The transfer function, H(z) of the digital filter is obtained by taking Z-transform of impulse response.
Since hd(n) is an infinite duration signal, the transfer function obtained from hd(n) will have infinite terms,
which cannot be realized or implemented in a digital system. Therefore, finite number of samples of hd(n) are
selected to form the impulse response, h(n) of the filter. The transfer function, H(z) is obtained by taking
Z-transform of finite sample impulse response, h(n). The filters designed by using finite samples of impulse
response are called FIR (Finite Impulse Response) filters.
Various Steps in Designing FIR Filter
H ( e jω ) = C e − jαω ; ω1 ≤ ω ≤ ω 2
.....(6.1)
= 0 ; otherwise
From equation (6.2) we can say that the LTI system output is simply a delayed and amplitude scaled
version of the input signal. A pure delay is usually tolerable and is not considered as distortion of the signal.
Likewise the amplitude scaling. Hence, the LTI system with frequency response defined by equation (6.1)
represents an ideal filter (in this example it is bandpass filter).
In general, an LTI system modifies the input spectrum X(ejw ) according to its frequency response
H(e ) to yield an output signal with spectrum, Y(ejw ) = H(ejw ) X(ejw ). In a sense, H(ejw ) acts as a weighting
jw
function or a spectral shaping function to the different frequency components in the input signal. When
viewed in this context any LTI system can be considered to be a frequency shaping filter, even though it may
not completely block any or all frequency components. Consequently the terms LTI system and filter are
synonymous, and are often used interchangeably. The frequency selective filters must be designed to
introduce negligible distortion in the signals that pass through them.
From equation (6.3) we can say that the magnitude of frequency response is constant and its phase is
a linear function of frequency. Therefore, if the phase function of frequency response of a filter is linear
function of frequency, then the filter is called linear phase filter.
In general, any deviation of the frequency response characteristics of a linear filter from the ideal
results in signal distortion. If the filter has a frequency variable magnitude response characteristic in the
passband then the filter introduces amplitude distortion. If the phase characteristic is not linear within the
desired frequency band, the signal undergoes phase distortion.
In order to examine the linear and nonlinear phase characteristics, two delay functions are defined and
they are phase delay and group delay.
θ( ω )
Phase delay, τ p = − .....(6.4)
ω
d
Group delay, τ g = − θ( ω ) .....(6.5)
dω
Chapter 6 - FIR Filters 6. 4
From equation (6.3),
θ(ω ) = −αω
θ( ω ) − αω
∴ τp = − =− =α
ω ω
d d
τg = − θ( ω ) = − ( − αω ) = α
dω dω
From the above equations it is observed that for a linear-phase filter, the delay is a constant, independent
of frequency. Consequently a filter that causes phase distortion has a variable frequency delay and one that
has linear phase has a constant delay within the desired frequency range. If the delay is not a constant within
the desired frequency range, we say that the filter introduces delay distortion. Thus delay distortion is
synonymous with phase distortion.
6.3 Ideal Frequency Response of Linear Phase FIR Filters
The filters are classified according to their frequency response characteristics. The ideal (desired)
frequency response Hd(ejw ) of four major types of filters are given below. The Hd(ejw ) is periodic, with
periodicity of 0 to 2p (or –p to +p). Also any analog frequency W will map (or can be converted) to frequency
of digital system w within the range 0 to 2p (or –p to +p). Hence the frequency response of digital filters are
defined in the interval 0 to 2p (or –p to +p).
Note : For conversion from analog frequency to frequency of digital system refer Impulse invariant transformation
or Bilinear transformation in Chapter 7.
Ideal frequency
response of lowpass filter , H d ( e jω ) = 0 ; for ω = − π to − ω c
− jαω
=Ce ; for ω = − ω c to + ω c
=0 ; for ω = + ω c to + π .....(6.6)
Ideal frequency
response of highpass filter , H d ( e jω ) = C e − jαω ; for ω = − π to − ω c
=0 ; for ω = − ω c to + ω c
=Ce − jαω
; for ω = + ω c to + π .....(6.7)
Ideal frequency
response of bandpass filter , H d (e jω ) = 0 ; for ω = − π to − ω c2
− jαω
=Ce ; for ω = − ω c2 to − ω c1
=0 ; for ω = − ω c1 to + ω c1
− jαω
=Ce ; for ω = + ω c1 to + ω c2
=0 ; for ω = + ω c2 to + π .....(6.8)
Ideal frequency
response of bandstop filter , H d (e jω ) = C e − jαω ; for ω = − π to − ω c2
=0 ; for ω = − ω c2 to − ω c1
− jαω
=Ce ; for ω = − ω c1 to + ω c1
=0 ; for ω = + ω c1 to + ω c2
=Ce − jαω
; for ω = + ω c2 to + π .....(6.9)
6. 5 Digital Signal Processing
|H d ( ω)| |H d ( ω)|
C C
−π −ω C 0 +ω +π C ω −π −ω C 0 +ω +πC ω
F ig 6.1 : M a g n itu de resp on se o f id ea l F ig 6.2 : M a g n itu de resp on se o f id ea l
low p a ss filter. h ig h p a ss filter.
jω
|H d (e jω)| |H d (e )|
C C
|H (e jω)|
1+ δp
Passband ripple
1−δp
Transition band
δs
Passband
Stopband
Stopband
ripple
0
ωp ωs π ω
δp - Passband ripple ; ωp - P assband edge frequency
δs - Stopband ripple ; ωs - Stopba nd edge frequency
θ( ω ) = ∠H (e jω ) = Phase function
H ( e jω ) = Magnitude function
Note : The magnitude is strictly positive, but the amplitude can be positive or negative.
From the property of Fourier transform when h(n) is real we can say that the magnitude function is a
symmetric function and the phase function is an antisymmetric function.
\ |H(ejw )| = |H (-ejw )|
|q(w)| = - |q (-w)|
Linear Phase and Symmetric Impulse Response
For many practical FIR filter, exact linearity of phase is a desired goal. Let us assume that the phase of
H(ejw ) is a linear function of w. Hence q(w) is directly proportional to w.
\ q(w) µw or q(w) = -aw ; for -p £ w £ +p .....(6.13)
where, a is a constant phase delay in samples
From equation (6.10) we get,
N−1
H(e jω ) = ∑ h( n) e− jωn .....(6.14)
n=0
sin αω
∑ h( n) sin ωn
n=0
= N−1
cos αω
∑ h( n) cos ωn
n=0
= h( n) sin e jω
N 1 − 2n
2
n = N −1 − n
= h( n) sin e jω
N 1−n−n
2
= h( n) sin e jωnn
2
= h( n) sin 0
=0
From the condition, a = (N - 1)/2 we can say that for every value of N there is only one value of phase
delay a for which linear phase can be obtained easily.
From the condition h(n) = h(N - 1 - n) we can say that for this value of a, [i.e., a = (N - 1)/2] the h(n)
has a special kind of symmetry. The impulse response h(n), when a = (N - 1)/2 and for odd and even values
of N are shown in fig 6.6 and 6.7 respectively. It can be observed that the impulse response is symmetric about
the centre of the sequence.
Chapter 6 - FIR Filters 6. 8
C entre of sy m m etry
h (n ) h (n ) C entre of sy m m etry
N = 11, α = − = 5
N 1 N −1
N = 10, α = = 4.5
2 2
0 1 2 3 4 5 6 7 8 9 10 n 0 1 2 3 4 5 6 7 8 9 n
F ig 6.6 : E xa m p le of sym m etric im p ulse F ig 6.7 : E xa m p le of sym m etric im p ulse
resp o n se for o d d N . response for even N .
Linear Phase and Antisymmetric Impulse Response
The definition of linear phase filter q(w) = -aw requires the filter to have both constant group delay
and constant phase delay. If only constant group delay is required an another type of linear phase filter is
defined in which the phase of H(ejw ) is a piece-wise linear function of w. For this case H(ejw ) can be expressed
in the Euler form as shown in equation (6.20).
H ( e jω ) = ± H ( e jω ) e j(β − αω ) .....(6.20)
jw
When H(e ) is expressed in the form of equation (6.20), we can prove that the only possible solution
of h(n) exists if,
N−1 π
α = 2
; β = ± 2
and h(n) = –h(N – 1 – n) ; for 0 £ n £ (N – 1) .....(6.21)
The filters that satisfy the three conditions of equation (6.21) have a delay of [(N - 1)/2] samples but
their impulse responses are antisymmetric around the centre of the sequence, as opposed to the true linear
phase sequences that are symmetric around the centre of the sequence.
h (n ) C entre of antisym m etry
h (n ) C entre of antisym m etry
N −1
N −1 N = 10, α = = 4.5
N = 11, α = =5 2
2
0 0
1 2 3 4 5 6 7 8 9 10 n 1 2 3 4 5 6 7 8 9 n
The frequency response of linear phase FIR filter when impulse response is symmetric and N is odd
with centre of symmetry at (N – 1)/2 is given by,
LM N −1
2
OP − jω N −1
e2j
H ee j = M hd
jω
i + ∑ 2h d
N −1
2
N −1
2
− ni cos ωn P e .....(6.22)
MN n=1 PQ
Let, H(ejw ) = A(w) e jq(w) .....(6.23)
where, A(w) = Amplitude function
q(w) = Phase function
On comparing equations (6.22) and (6.23) we get,
N −1
2
Amplitude function, A(ω ) = hd i + ∑ 2 h d − ni cos ωn
N −1
2
N −1
2 .....(6.24)
n=1
A typical sketch of symmetric impulse response when N = 9 and its corresponding amplitude function
of frequency response are shown in fig 6.10 and fig 6.11 respectively. From these sketches it can be observed
that the amplitude function of H(ejw ) is symmetric with w = p, when the impulse response is symmetric and N
is odd number.
When impulse response is symmetric and N is odd, the frequency response is non-zero at
w = 0 and w = p, and so this frequency response can be used to design lowpass, highpass, bandpass and
bandstop filters.
N −1
α= =4
2
Chapter 6 - FIR Filters 6. 10
Proof:
The Fourier transform of h(n) is,
h( n) is defined
+∞ N −1
jω − jωn − jωn
H(e ) = ∑ h( n) e = ∑ h(n) e for n = 0 to N − 1
n = −∞ n=0
When N is odd number the symmetric impulse response will have the centre of symmetry at n = (N - 1)/2.
Hence H(ejw ) is expressed as,
N 3
− jω N − 1 N−1
2
e j
jω
H(e ) = ∑ h(n) e− jωn + he N 2 1 j e 2
+ ∑ h(n) e− jωn
n= 0 n= N+1
2
N− 3
2 − jω N − 1
e j Let, m = N 1 n ; \ n = N 1 m
= ∑ h(n) e− jωn +h e N 1
2 je 2
When, n = N + 1 ; m = N − 1− N + 1 = N − 3
n= 0 2 2 2
N− 3 When, n = N 1 ; m = N 1 (N 1)= 0
2
+ ∑ h(N − 1 − m) e− jω(N − 1 − m)
m= 0
N−3 N−3
2 − jω N − 1 e j 2
= ∑
n=0
h( n) e − jωn
+h e N 1
2 je 2
+ ∑ h(N − 1 − n) e− jω(N − 1 − n)
n=0
Put, m = n
N−3 N−3
− jω N − 1
For symmetric
2
e j 2
= ∑
n=0
h( n)e − jωn
+h e N 1
2 je 2
+ ∑ h( n)e− jω(N − 1 - n)
n=0
impulse response,
h(N 1 n) = h(n).
R| N−3
2 L e j jω N − 1 e j O U| e j jω N − 1 − jω N − 1
= She h( n) Me PPV e
|T j ∑ MN
N 1 − jωn 2 − jω ( N − 1 − n ) 2 2
+ e +e e
2
n=0 Q|W
R| N−3
2 L e jω N − 1 − n
j+e e
U
j O| e e j − jω (N − 1) − N − 1 − n − jω N − 1
= S he + ∑ h( n) Me P
j PQV|W
N 1 2 2 2
|T 2
n=0 MN
R| N−3
2 L e jω N − 1 − n
j+e e
U
j O| e e j − jω N − 1 − n − jω N − 1
= She + ∑ h( n) Me P
j PQV|W
N 1 2 2 2 jθ − jθ
e +e
|T
2
n=0 MN cosθ =
2
R| N−3
2
U| e j − jω N − 1
= S he F I
K jV e
|T j ∑ eH
N 1 N−1 −n 2
+ h ( n) 2 cos ω
2
n=0 |W 2
N −1 N −1
−n ; n= −k
R| N−1
2
U| e j Let, k=
When, n = 0 ; k = − jω N − 1
2 2
N −1
= She − kj cos ωkV e
|T j ∑ e
N 1 N 1 2 2
+ 2h
2
k=1
2
|W When, n = ; k= =1 N −3
2
N −1 N − 3
2
−
2
R| N−1
2
U| e j − jω N − 1
= She
|T j ∑ e
N 1
2
+ 2 h − n j
N 1
cos
2
ω n V| e Put, k = n 2
n=1
W
6. 11 Digital Signal Processing
Case (ii) : Frequency response of linear phase FIR filter when impulse response is symmetric and N is even with
centre of symmetry at (N – 1)/2
The frequency response of linear phase FIR filter when impulse response is symmetric and N is even
with centre of symmetry at (N – 1)/2 is given by,
LM N O F N − 1I
2
H ee j = M ∑ 2 h e
jω
j cos FGH IjJ P e− jω H 2 K
N −n
2
ω n− 1
e 2 KP .....(6.27)
MN n=1 PQ
Let, H(ejw ) = A(w) ejq(w) .....(6.28)
where, A(w) = Amplitude function
q(w) = Phase function
On comparing equation (6.27) and (6.28) we get,
N
2
Amplitude function, A ω = b g ∑ 2 he j cose e N −n
2
ω n− 1
2 jj .....(6.29)
n=1
The sketch of symmetrical impulse response when N = 8 and its corresponding amplitude function of
frequency response are shown in fig 6.12 and 6.13 respectively. From these sketches it can be observed that
the amplitude function of H(ejw ) is antisymmetric with w = p, when impulse response is symmetric and N is
even number.
When impulse response is symmetric and N is even, the frequency response is non-zero at
w = 0 and zero at w = p, and so this frequency response can be used to design lowpass and bandpass filters
but cannot be used to design highpass and bandstop filters.
Centre of antisymmetry
Centre of symmetry
N=8
N−1
α= = 3 .5
2
+∞ N−1
H(e jω ) = h(n) is defined for
∑ h(n) e− jωn = ∑ h(n) e− jωn n = 0 to N 1
n = −∞ n=0
For symmetric impulse response with even number of samples (i.e., when N is even), the centre of
symmetry lies between n = (N/2)1 and n = N/2. Hence H(ejw ) is expressed as,
N −1
2 N−1
jω
H(e ) = ∑ h( n) e− jωn + ∑ h(n) e− jωn
n= 0 n = N/2
N −1 N −1
Let, m = N − 1 − n ; ∴ n = N − 1 − m
2 2
= ∑ h( n) e − jωn
+ ∑ h(N − 1− m) e − jω (N −1− m)
When, n = N ; m = N −1− N = N − 1
n= 0 m= 0
2 2 2
When, n = N − 1 ; m = N − 1 − (N − 1) = 0
N −1 N −1
2 2
= ∑ h( n) e − jωn
+ ∑ h(N − 1 − n) e − jω (N − 1 − n)
Put, m = n
n= 0 n= 0
N − 1 N − 1 For symmetric
2 2
impulse response,
= ∑ h(n) e− jωn + ∑ h(n) e− jω (N−1−n)
h(N 1 n) = h(n).
n = 0 n = 0
LM
N − 1
F FG IJ N−1 FG IJ I O FG IJ N−1 N−1
2
= M ∑ h(n) G e − jωn H jω
K 2
e H
− jω (N−1−n)KJP e H K
jω
2
− jω
2
MN G
H
e +e
JK PP
n = 0
Q
N − 1
L FG N−1IJ F IJ O N−1 F I N−1
2
= ∑ h(n) Me H
jω
2 K + e GH b g
−n − jω
K P e GH JK
N− 1 −
2
−n − jω
2
n = 0
MN PQ
LM N −1
2 F F IK + e FH IK I OP e FH IK
jω
N −1
−n − jω
N −1
−n − jω
N −1
= M ∑ h( n) G e H JK P
2 2 2
MN n=0 H PQ
jθ − jθ
LM N −1
2
OP FH IK − jω
N −1
cosθ = e + e
2
= M ∑ h( n) 2 cos e e jjP e 2
ω N −1 − n
2
MNn=0 PQ
LM
N −1 O F I
ijPP e H K
2 N −1
− jω
= M ∑ 2 h( n) cose d N 1 2
ω − n −
2 2
MN
n=0 PQ
LM N
2
OP FG IJ − jω
N −1 Let, k = − n ; ∴ n= −k N
2
N
2
= M∑ 2 he H K
MNk=1
2j cose e jjPP e
N− k ω k− 1
2
2
When, n = 0 ; k= N
2
Q When, n = − 1 ; k = − d − 1i =1 N
2
N
2
N
2
LM
N
2
OP FG IJ − jω
N −1
= M ∑ 2 he
MM
n=1
2 j cose e jjPP e H K
N − n ω n− 1
2
2
Put, k = n
N PQ
6. 13 Digital Signal Processing
Case (iii) : Frequency response of linear phase FIR filter when impulse response is antisymmetric and N
is odd with centre of antisymmetry at (N – 1)/2
The frequency response of linear phase FIR filter when impulse response is antisymmetric and N is
odd with centre of antisymmetry at (N – 1)/2 is given by,
LM N −1
2
OP FG
j π−
ω ( N −1) IJ
H ee j = M ∑ 2 h e j sin ωn e H K
jω 2 2
MN
N −1 − n
2 PP .....(6.32)
n=1
Q
Let, H(ejw ) = A(w) ejq(w) .....(6.33)
where, A(w) = Amplitude function
q(w) = Phase function
On comparing equations (6.32) and (6.33) we get,
N−1
2
Amplitude function, A (ω ) = ∑ 2 he N 2− 1 − nj sin ωn .....(6.34)
n=1
ω
Phase function, θ(ω ) = π – (N2 – 1) = β – αω .....(6.35)
2
π N − 1
where, β = and α =
2 2
N−1
2
Magnitude function, H ( e jω ) = A (ω ) = ∑ 2 he N 2− 1 − nj sin ωn .....(6.36)
n=1
A typical sketch of antisymmetric impulse response when N = 9 and its corresponding amplitude
function of frequency response are shown in fig 6.14 and fig 6.15 respectively. From these sketches it can be
observed that the amplitude function is antisymmetric with w = p when the impulse response is antisymmetric
and N is odd number.
The term ejp/2 makes the frequency response imaginary. Hence this frequency response is suitable for
designing Hilbert transformers and differentiators.
N=9
N −1
α= =4
2
n = −∞ n=0
N−3
− jω N − 1 N−1 The impulse response is
2
e j+
= ∑
n=0
h( n) e− jωn + h e j N−1
2
e 2
∑ N+1
h( n) e− jωn antisymmetric with centre of
N −1
n= 2 antisymmetry at n = 2
N− 3
2 N−1
= ∑ h(n) e− jωn + ∑ h(n) e− jωn
N+1
h
N −1
e j=0
2
n=0 n= 2
N−3 N −3
2 2 Let, m = N 1 n ; \ n = N 1 m
= ∑ h( n) e− jωn + ∑ h(N −1 − m) e − jω( N −1− m)
LM N−3
2 F FG IJ
jω
N−1
jω
FG N − 1IJ I OP − jω
FG N − 1IJ
h(N 1 n) = h(n).
= M ∑ h( n) G e − jωn
e
H K−e 2 − jω ( N − 1 − n )
e
H 2 K JJ P e H 2 K
MM n=0 G
H K PPQ
N
LM
N−3
2 F FHG
jω
N−1
−n
IJ FG
− jω ( N −1) − n −
N−1 IJ I OP − jω
FG N − 1IJ
= M ∑ h( n) e G 2 K − e
H 2 K JJ P e H 2 K
MM
n=0 G
H K PPQ
N
LM N−3
F FHG N−1 IJ F N−1 IJ I OP F N −1I
2
= M ∑ h( n) G e
jω
2
−n
K − e HG − jω
2
−n
JJ P e HG KJ
K − jω
2
e jθ − e− jθ
MM n=0 GH K PPQ sinθ =
N 2j
L OP I LM OP
N 3
N3
F N −1 2 jπ FG N −1IJ
= M
− jω −jω
2 H 2 K= F I H 2K
MM ∑ h( n) 2j sin ee
ω
N1
2
njjPP e MM ∑ 2 h(n)e
n=0
2
e
sin ω GH N2−1 − nJK jPP e
n=0
N Q N Q j= e
j
π
2
N−3
2
LM OP FG j
π
−
ω(N − 1) IJ Let, k =
N−1
− n ; ∴ n=
N−1
− k
eH K 2 2
= M ∑ 2 h( n) sineω e N−1
−n jj P 2 2
N−1
n=0 MN 2
PQ When, n = 0 ; k= 2
N −1
2
LM OP FG j
π
−
ω(N −1) IJ When, n =
N−3
2
; k=
N−1 N−3
2
− 2 =1
= M ∑ 2 he N −1
−k j sin ω k P eH 2 2 K
k=1 MN 2
PQ
LM
N −1
2
OP FG j
π
−
ω(N −1) IJ
= M∑ 2 he
MN
n =1
N −1
2
−n j sin ωnPP e H 2 2 K Put, k = n
Q
6. 15 Digital Signal Processing
Case (iv) : Frequency response of linear phase FIR filter when impulse response is antisymmetric and N is even
with centre of antisymmetry at (N – 1)/2
The frequency response of linear phase FIR filter when impulse response is antisymmetric and N is
even with centre of antisymmetry at (N – 1)/2 is given by,
LM N
2
OP FGH j π−
ω ( N −1) IJ
K
He e j = M ∑ 2 h e j e e jjP e
jω 1 2 2
sin
2
ω
N −n n−
2
MN n=1 PQ .....(6.37)
π
Phase function, θ(ω ) =
2 2
e j
– ω N – 1 = β – αω
π N−1 .....(6.40)
where, β = and α = 2
2
N
2
Magnitude function, H (e jω ) = A (ω ) = ∑ 2 he N2 − nj sinFH ωFGH n − 21 IJK IK .....(6.41)
n=1
The sketch of antisymmetric impulse response when N = 8 and its corresponding amplitude function
of frequency response are shown in fig 6.16 and fig 6.17 respectively. From these sketches it can be
observed that the amplitude function of H(ejw ) is symmetric with w = p, when the impulse response is
antisymmetric and N is even number.
The term ejp/2 makes the frequency response imaginary. Hence this frequency response is suitable for
designing Hilbert transformers and differentiators.
N=8
α= N − 1 = 3 .5
2
n=0 N
n=
2 Let, m = N1 n ; \ n = N 1m
N N
−1 −1 N N N
2 2
When, n = ; m = N − 1 − = −1
= ∑ h( n) e− jωn + ∑ h(N − 1 − m) e− jω(N −1− m) 2 2 2
n=0 m=0 When, n = N1 ; m = N 1 (N 1) = 0
N N
−1 −1
2 2
= ∑ h( n) e− jωn + ∑ h(N − 1− n) e− jω(N −1− n) Put, m = n
n=0 n=0
N N
−1 −1 For antisymmetric
2 2
= ∑ h( n) e − jωn
+ ∑ b− h( n)ge − jω( N − 1 − n) impulse response,
h(N 1 n) = h(n).
n=0 n=0
LM N
2
−1 F FG IJ
jω
N−1
jω
FG N − 1IJ I OP − jωFG N − 1IJ
= M ∑ h( n) G e − jωn
e
H K e 2 − jω(N − 1 − n)
e
H 2 K JP e H 2 K
MM n=0 GH JK P
N PQ
LM N
−1 F FGH N−1 IJ N−1 I OP FG N − 1IJ
2
= M ∑ h( n) G e
jω
2 K −e b g
−n − jω N − 1 − n −
2 JJ P e − jω
H 2 K
MM n=0 GH K PPQ
N
LMN
−1 F FGH N−1 IJ F N−1 IJ I OP − jω FG N 1IJ e jθ − e− jθ
2
= M ∑ h( n) G e
jω
2
n
K e GH − jω
2
n
KJP e H 2 K sinθ =
MM
n=0 GH JK P 2j
N PQ
LM
N
−1 OP FG N1 IJ
2
= M ∑ h( n) 2j sin ωe F N1
j I P e
− jω
H 2 K
MM
n=0
H 2
n
K PP
N Q
N
−1 LM jπ
OP FG N 1IJ
2
= M ∑ h( n) 2e sin H ω e 2 F N
n
1 I
jK PP e
− jω
H 2K
n =0 MM 2 2
PQ
N π
N LM
−1 OP FG π ω( N − 1) IJ j= e
j
2
2
= M ∑ 2 h(n) sinH ωe F N
−n−
1I
jK PP e H
j
2
−
2 K
MM
n= 0
2 2
PQ
N Let, k = N
2
−n ; ∴ n= N
2
−k
N
LM O F IJ N
FG IJ P e GH
2 π ω (N −1) When, n = 0 ; k=
j −
= M ∑ 2 he K 2
MN
N
2
−kj sin e ω H K jP k−
PQ
1
2
2 2
When, n = N
2
−1 ; k = N
2
− d −1i =1
N
2
k=1
N
2
LM OP FG j
π
−
ω(N −1) IJ Put, k = n
= M ∑ 2 he
n=1 MN
N
2
−n j sineωe jjPP e H n−
1
2
2 2 K
Q
6. 17 Digital Signal Processing
Case (v) : Frequency response of linear phase FIR filter when impulse response is symmetric and N is odd
with centre of symmetry at n = 0
The frequency response of linear phase FIR filter when impulse response is symmetric and N is odd
with centre of symmetry at n = 0, is given by,
N −1
2
.....(6.42)
e j
H e jω = h(0) + ∑ 2 h( n) cos ωn
n=1
A typical sketch of symmetric impulse response when N = 9 and its corresponding amplitude function
of frequency response are shown in fig 6.18 and fig 6.19 respectively. From these sketches it can be observed
that the amplitude function of H(ejw ) is symmetric with w = p, when the impulse response is symmetric and N
is odd number.
When impulse response is symmetric and N is odd, the frequency response is non-zero at
w = 0 and w = p, and so this frequency response can be used to design lowpass, highpass, bandpass and
bandstop filters.
N −1 = 4
2
N−1
−1 2 Here, centre of
= ∑ h(n) e − jωn
+ h(0) + ∑ h(n) e − jωn
symmetry is n = 0.
N−1 n=1
n= −
2
N−1 N−1
2 2 Using symmetry
= ∑ h(− n) e jωn + h(0) + ∑ h(n) e− jωn condition h( n) = h(n).
n=1 n=1
N−1 N−1
2 2
jωn
= ∑ h(n) e + h(0) + ∑ h(n) e− jωn
n=1 n=1
N−1
2
e jθ + e− jθ
= h(0) + ∑ h(n) e jωn + e− jωn cosθ =
2
n=1
N−1
2
= h(0) + ∑ h(n) 2 cos ωn
n=1
N−1
2
= h(0) + ∑ 2 h(n) cos ωn
n=1
Case (vi) : Frequency response of linear phase FIR filter when impulse response is antisymmetric and N
is odd with centre of antisymmetry at n =0
The frequency response of linear phase FIR filter when impulse response is antisymmetric and N is
odd with centre of antisymmetry at n = 0, is given by,
LM N −1
2
OP −jπ
Hee j = M ∑ 2 h( n) sin ωn P e
jω 2
.....(6.47)
MN n=1 PQ
Let, H(ejw ) = A(w) ejq(w) .....(6.48)
where, A(w) = Amplitude function
q(w) = Phase function
On comparing equations (6.47) and (6.48) we get,
N−1
2
Amplitude function, A (ω ) = ∑ 2 h( n) sin ωn .....(6.49)
n=1
π
Phase function, θ(ω ) = − .....(6.50)
2
N−1
2
Magnitude function, H ( e jω ) = A (ω ) = ∑ 2 h( n) sin ωn .....(6.51)
n=1
6. 19 Digital Signal Processing
A typical sketch of antisymmetric impulse response when N = 9 and its corresponding amplitude
function of frequency response are shown in fig 6.20 and fig 6.21 respectively. From these sketches it can be
observed that the amplitude function is antisymmetric with w = p when the impulse response is antisymmetric
and N is an odd number.
The term ejp/2 makes the frequency response imaginary. Hence this frequency response is suitable for
designing Hilbert transformers and differentiators.
Centre of antisymmetry Centre of antisymmetry
N −1
=4
2
Proof:
The Fourier transform of h(n) is,
h( n) is defined only
+∞ +N − 1
2
H(e jω ) = for n = − N 2− 1 to + N 2− 1 .
∑ h(n) e− jωn = ∑ h(n) e− jωn N −1
n = −∞ n= −
2
N−1
−1 2 Here, centre of
− jωn
= ∑ h(n) e + h(0) + ∑ h(n) e− jωn antisymmetry is n = 0.
N−1 n=1
n= −
2
N−1 N−1
2 2 Here, h(0) = 0
jωn
= ∑ h(− n) e + ∑ h( n) e− jωn
n=1 n=1
N−1 N−1
Using symmetric
2 2
jωn − jωn condition h( n) = h(n).
= ∑ (− h(n)) e + ∑ h(n) e
n=1 n=1
N−1 N−1
2 2 e jθ − e− jθ
jωn − jωn sinθ =
= − ∑ h(n) e −e = − ∑ h(n) 2 j sin ωn 2j
n=1 n=1
LM N−1
2
OP LM OP
N−1
2 −j
π π
−j
= M ∑ 2h( n) sin ωn P (− j) = M ∑ 2h( n) sin ωn P e 2
−j= e 2
MM n=1 PP MM PP
n=1
N Q N Q
Chapter 6 - FIR Filters 6. 20
Table 6.1 : Summary of Frequency Response Characteristics of Linear Phase FIR Filters
Case h(n) N A(w
w)
[Impulse Response] [Number of Symmetry [Amplitude
samples of h(n)] condition function of H(ejww )]
i Symmetric Odd h(N – 1 – n) = h(n) Symmetric
ii Symmetric Even h(N – 1 – n) = h(n) Antisymmetric
iii Antisymmetric Odd h(N – 1 – n) = – h(n) Antisymmetric
iv Antisymmetric Even h(N – 1 – n) = – h(n) Symmetric
v Symmetric Odd h(– n) = h(n) Symmetric
vi Antisymmetric Odd h(– n) = –h(n) Antisymmetric
Table 6.2 : Summary of A(w
w ) for Linear Phase FIR Filters
Case h(n) N Symmetry Magnitude function,
[Impulse response] condition |H(ejww )| = |A(w
w )|
N−1
2
N −1
i Symmetric Odd h(N – 1 – n) = h(n)
he j + ∑ 2 he
N –1
2
n=1
2 j
– n cos ωn
N
2
N–1
2
N −1
2
N −1
2
where, the Fourier coefficients hd(n) are the desired impulse response sequence of the filter.
The samples of hd(n) can be determined using equation (6.53), which is inverse Fourier transform of Hd(ejw ).
π
hd ( n) =
1
2π − πz e j
H d e jω e jωn dω .....(6.53)
The impulse response obtained from equation (6.53) is an infinite duration sequence. For FIR filters we
truncate this infinite impulse response to a finite duration sequence of length N, where N is odd.
N −1
∴ h( n) = hd ( n) ; for n = − e j to + e j
N −1
2 2
Let, HN(z) = Z{h(n)}
By definition of Z-transform,
N−1
2
H N ( z) = ∑ h( n) z − n .....(6.54)
N−1
n=−
2
The transfer function of equation (6.54) represents noncausal filter (due to the presence of positive
powers of z). Hence the transfer function of equation (6.54) is multiplied by z-(N - 1)/2 .
−
N −1
N −1
2
−
N −1
LM −1
N −1
2
OP
\ H(z) = z –(N – 1)/2
HN(z) = z 2
∑ h( n) z
N −1
−n
=z 2
MM ∑ h(n) z
N −1
−n
+ h(0) + ∑ h( n) z −n
PP
n= −
2 N
n= −
2
n=1
Q
−
N −1
LM
N −1
2
N −1
2
OP The Fourier coefficients h(n)
= z 2
MM ∑ h(−n) z + h(0) + ∑ h(n) z
n −n
PP is symmetric, with n = 0.
n=1
N n=1
Q \ h(–n) = h(n)
−
N −1
LM N −1
2
OP
= z 2
MM h ( 0) + ∑ h ( n ) z + z n
PP −n
.....(6.55)
N n=1
Q
Hence we see that causality is brought about by multiplying the transfer function by the delay factor
a = (N - 1)/2. This modification does not affect the amplitude response of the filter, however the abrupt
truncation of the Fourier series results in oscillations in the passband and stopband. These oscillations are
due to the slow convergence of the Fourier series, particularly near the points of discontinuity. This effect is
known as Gibbs phenomenon. The undesirable oscillations can be reduced by multiplying the desired impulse
response coefficients by an appropriate window function.
6. 23
Table 6.3 : Specification and Desired Impulse Response for FIR Filter Design by Fourier Series Method
π +ω c
Lowpass H d ( e jω
R|1 ; for
) = S0 ; for
– ωc ≤ ω ≤ + ωc
−π ≤ ω < – ωc
h d ( n) =
1
2π z
−π
jω
H d (e ) e jωn
dω =
1
2π z
−ω c
e jωn dω
||0 ; for jω
T ωc < ω ≤ π Q H d (e ) = 0 in the range − π ≤ ω < − ω c and + ω c < ω ≤ π
π −ω c π
Highpass H d (e jω
R|1 ; for
) = S1 ; for
– π ≤ ω ≤ – ωc
ωc ≤ ω ≤ π
h d ( n) =
1
2π z
−π
H d (e jω ) e jωn dω =
1
2π z
−π
e jωn dω +
1
2π z
ωc
e jωn dω
||0 ; for jω
T – ωc < ω < + ωc Q H d ( e ) = 0 in the range − ω c < ω < +ω c
R|1 ; for – ω c2 ≤ ω ≤ – ω c1 π − ω c1 ω c2
Bandpass H d ( e jω
||1 ; for
) = S0 ; for –π
ω c1 ≤ ω ≤ ω c2
≤ ω < − ω c2
h d ( n) =
1
2π z
−π
H d ( e jω ) e jωn dω =
1
2π z
−ω c2
e jωn dω +
1
2π
ω c1
z e jωn dω
||0 ; for – ω c1 < ω < + ω c1 Q H d ( e jω ) = 0 in the range − π ≤ ω < −ω c 2 ; − ω c1 < ω < + ω c1 and + ω c2 < ω ≤ π
||0 ; for
T ω c2 < ω ≤ π
R|1 ; for –π ≤ ω ≤ – ω c2 −ω c2 ω c1
Bandstop
|1 ; for
|
) = S1 ; for
– ω c1 ≤ ω ≤ + ω c1 h d ( n) =
1
2π z
π
H d ( e jω ) e jωn dω =
1
2π z e jωn dω +
1
2π z e jωn dω +
1
2π z
+π
e jωn dω
The impulse response is symmetric with n = 0, and so h(–n) = h(n). Hence it is sufficient if we,
calculate h(n) for n = 0 to +(N – 1)/2.
4. Take Z-transform of the impulse response to get the noncausal transfer function of FIR filter, HN(z).
N −1
+
2
l q
∴ H N ( z) = Z h ( n ) = ∑ h( n ) z − n
N −1
n=−
2
5. Convert the noncausal transfer function, HN(z) to causal transfer function, H(z) by multiplying
HN(z) by z –(N – 1)/2
N −1
+
N −1 2
−
∴ Transfer function, H(z) = z 2
∑ h( n) z − n
N −1
n=−
2
Alternatively,
−
N −1
LM N −1
2
OP Applying symmetry
condition, h(–n) = h(n).
Transfer function, H(z) = z 2
MMh(0) + ∑ h(n) z n
+z −n
PP Refer equation (6.55).
N n=1
Q
6. Draw a suitable structure for realization of FIR filter.
6. 25 Digital Signal Processing
Design verification
1. Determine the frequency response, H(ejw ).
Method - 1 : Choose a linear phase magnitude function |H(ejw )| from table 6.2. Using h(n),
obtain an equation for |H(ejw )|.
Method - 2 : The frequency response, |H(ejw )| can be obtained by replacing z by ejw in the
transfer function, H(z).
∴ Frequency response, H e jω = H ( z) e j z = e jω
Example 6.1
Design a FIR lowpass filter with cutoff frequency of 1 kHz and sampling frequency of 4 kHz with 11
samples using Fourier series method. Determine the frequency response and verify the design by sketching the
magnitude response.
Solution
Given that, Fc = 1 kHz ; Fs = 4 kHz
Ωc 2 πFc 2π × 1 × 10 3
∴ ω c = Ω cT = = = = 0.5 π rad / sample
Fs Fs 4 × 103
Hd (e jω ) = 1 ; for ω c ≤ ω ≤ + ω c
= 0 ; for π ≤ ω < − ω c and ωc < ω ≤ π
hd (n) =
1
2π z
−π
Hd (ejω ) e jωn dω =
1
2π z
−ω c
1 × e jωn dω
=
LM e OP = 1 LM e − e OP
1 jωn +ω c jω cn
e − e
− jω cn
jθ jθ
When n = 0, the factor
sinω cn
N jn Q 2π MN jn jn PQ sinθ = 2j
2π −ω c πn
becomes 0 / 0,
which is indeterminate.
1 Le −e OP = 1 sin ω n ; for all n, except n = 0.
jω cn − jω cn
=
πn N
M 2j Q πn c
U sin g L' Hospital rule,
sin ω cn 1 sin ω cn ω c sin Aθ
When, n = 0 ; hd (n) = hd (0) = Lt = Lt = Lt =A
n→ 0 πn π n→0 n π θ→ 0 θ
The impulse response h(n) of FIR filter is obtained by truncating hd(n) to 11 samples.
sin ω cn N−1 N−1
∴ h(n) = hd (n) = ; for n = − 2 to +
2
, except n = 0
nπ
ωc
= ; for n = 0
π
N − 1 11 − 1
Here, N = 11, ∴ = =5
2 2
Hence, calculate h(n) for n = 5 to +5
Since, the impulse response h(n) satisfies the symmetry condition, h(n) = h(n), calculate h(n) for n = 0 to 5.
Chapter 6 - FIR Filters 6. 26
ωc
When n = 0 ; h(0) = = 0.5
π
When n = 1 ; h(1) =
c
sin 0.5π × 1 h = 0.3183
π ×1 Note : Calculate sin q by keeping the
calculator in radian mode.
When n = 2 ; h(2) =
c
sin 0.5π × 2 h=0
π ×2
When n = 3 ; h(3) =
c
sin 0.5π × 3 h = −0.1061
π ×3
When n = 4 ; h(4) =
c
sin 0.5π × 4 h=0
π×4
When n = 5 ; h(5) =
c
sin 0.5π × 5 h = 0.0637
π×5
The transfer function H(z) of the digital lowpass filter is given by,
−
N−1
−
N−1
LM+
N−1
2
OP 5
H(z) = z 2 l q
Z h(n) = z 2
MM ∑ h(n) z
N−1
−n −5
PP = z ∑ h(n) z −n
n = −5
N
n= −
2 Q
= z−5 [h(−5) z5 + h( −4) z4 + h(−3) z3 + h(−2) z2 + h( −1) z + h(0) z0 + h(1)z−1 + h(2) z −2
= z−5 h(0) + h(1) z + z−1 + h(2) z2 + z−2 + h(3) z3 + z−3 + h(4) z4 + z−4 + h(5) z5 + z−5
Y(z)
Let , H(z) = = 0.5 z −5 + 0.3183 z−4 + z−6 − 0.1061 z−2 + z−8 + 0.0637 1 + z −10
X(z)
∴ Y(z) = 0.5 z−5 X(z) + 0.3183 z−4 X(z) + z−6 X(z) − 0.1061 z−2 X(z) + z−8 X(z)
The above equation can be used to draw the FIR filter structure as shown in fig 1.
6. 27 Digital Signal Processing
−1 −2 −3 −4 −5
X (z ) −1
z X (z ) −1
z X (z ) −1
z X (z )
−1
z X (z ) −1
z X (z )
z z z z z
w
+ + +
−1 −1 −1 −1 −1
z z z z z
−10 −9 −8 −7 −6
z X (z ) z X (z ) z X (z ) z X (z ) z X (z )
0 .0 6 37 −0.1061 0.31 83
0 .5
−2 −8 −4 −6 −5
−10 −0.1061[z X (z ) + z X (z )] 0.3183[z X (z ) + z X (z )] 0.5z X (z)
0.0637[X (z) + z X (z )]
+ + + Y (z)
F ig 1 : L in ea r ph a se stru c tu re o f F IR lo w p a ss filter.
Frequency Response
When impulse response is symmetric and N is odd with centre of symmetry at n = 0, the magnitude
response, |H(ejww )| is given by |A(w
w )|,
N− 1
2
where, A(ω ) = h(0) + ∑ 2 h(n) cos ωn Refer table 6.2 case (v)
n =1
5
= h(0) + ∑ 2 h(n) cos ωn
n =1
= h(0) + 2 h(1) cos ω + 2 h(2) cos 2ω + 2 h(3) cos 3ω + 2 h(4) cos 4ω + 2 h(5) cos 5ω
= 0.5 + 2 × 0.3183cosω + 2 × 0 cos2ω + 2 × −0.1061 cos 3ω + 2 × 0cos 4ω
+ 2 × 0.0637cos5ω
= 0.5 + 0.6366 cosω − 0.2122 cos 3ω + 0.1274 cos 5ω
Using the above equation the amplitude response A(w) and magnitude function |H(ejw )| are calculated for
various values of w and listed in table 1. Using the tabulated values, the magnitude response is sketched as
shown in fig 2.
1.0
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
ω
0 π 2π 3π 4π 5π 6π 7π 8π 9π 10 π 11π 12 π 13 π 14 π 15 π 16 π
16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16
( π/2 ) ( π)
F ig 2 : M a gn itu d e resp o n se o f F IR low p a ss filte r.
Alternate Method for Frequency Response
e j
Frequency response, H e jω = H ( z)
z = e jω
e j
∴ H e jω = 0.5z −5 + 0.3183 z −4 + z −6 − 01061
. z −2 + z −8 + 0.0637 1 + z −10
z = e jω
− 01061
. cos 2ω − j sin 2ω + cos8ω − j sin 8ω + 0.0637 1 + cos10ω − jsin 10ω
= [0.5cos5ω + 0.3183 cos 4ω + 0.3183 cos 6ω − 0.1061cos 2ω − 0.1061cos8ω + 0.0637 + 0.0637 cos10ω ]
e j
Hd ejω = 1 ; for − π ≤ ω ≤ −ω c and ωc ≤ ω ≤ π
= 0 ; otherwise
The desired impulse response hd(n) of the highpass filter is,
π −ω c π
hd (n) =
1
2π z
−π
e j
Hd e jω e jωn dω =
1
2π z
−π
1 × e jωn dω +
1
2π z
ωc
1 × e jωn dω
=
1 LM e OP
jωn − ω c
+
1 LM e OP
jωn π
=
1 LM e
− jω cn
−
OP
e − jπn
+
1 LM e
jπn
−
e jω cn OP
2π MN jn PQ −π
2π MN jn PQ ωc
2π MN jn jn PQ 2π MN jn jn PQ
=
1 LM e − e
jπn − jπn
−
e jω cn
− e− jω cn OP
πn MN 2j 2j PQ e jθ − e− jθ
sinθ =
2j
1
= sin πn − sin ω cn ; for all n, except n = 0.
πn
N−1 7 −1
Here, N = 7, ∴ = =3
2 2
Hence, calculate h(n) for n= 3 to 3.
Since, the impulse response h(n) satisfies the symmetry condition, h(n) = h(n), calculate h(n) for n = 0 to 3.
Chapter 6 - FIR Filters 6. 30
ωc
When n = 0 ; h(0) = 1 − = 0.4
π
When n = 1 ; h(1) = −
b
sin 0.6π × 1 g = −0.3027
π ×1
When n = 2 ; h(2) = −
b
sin 0.6π × 2 g = 0.0935
π×2
When n = 3 ; h(3) = −
b
sin 0.6π × 3 g = 0.0623
π×3
The transfer function H(z) of the digital highpass filter is given by,
N−1
+
(N−1) (N−1) 2 +3
− −
H(z) = z 2 Z lh(n)q = z 2
∑N−1h(n) z−n = z−3 ∑ h(n) z−n
n= − n =−3
2
Y(z)
Let , H(z) = = 0.4 z −3 − 0.3027 z−2 + z−4 + 0.0935 z−1 + z −5 + 0.0623 1 + z−6
X(z)
Y(z) = 0.4z−3X(z) − 0.3027 z−2 X(z) + z−4X(z) + 0.0935 z−1X(z) + z −5X(z) + 0.0623 X(z) + z−6 X(z)
The above equation can be used to draw the FIR filter structure as shown in fig 1.
−1 −2 −3
z X(z) z X(z) z X(z)
+ + +
−6 −5 −4
z X(z) z X(z) z X(z)
−3
0.0623 X(z) + z −6 X(z) 0.0935 z −1X(z) + z −5 X(z) −0.3027 z −2 X(z) + z −4 X(z)
NM QP 0.4z X(z)
+ + +
F ig 1 : L in e ar p h a se struc ture o f F IR h ig h p a ss filter.
6. 31 Digital Signal Processing
Frequency Response
When impulse response is symmetric and N is odd with centre of symmetry at n = 0, the magnitude
response |H(ejww )| is given by |A(w
w )|,
N−1
2 3
Refer table 6.2 case (v)
where, A(ω ) = h(0) + ∑ 2 h(n) cos ωn = h(0) + ∑ 2 h(n) cos ωn
n =1 n =1
|H (e jω)|
1.1
1.0
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
ω
0 π 2π 3π 4π 5π 6π 7π 8π 9π 10 π 11π 12 π 13π 14 π 15π 16π
16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16
( π/2 ) ( π)
F ig 2 : M a gn itu d e resp o n se o f F IR h igh p a ss filte r.
Chapter 6 - FIR Filters 6. 32
e j
Frequency response, H e jω = H ( z)
z = e jω
e j
∴ H e jω = 0.4 z −3 − 0.3027 z −2 + z −4 + 0.0935 z −1 + z −5 + 0.0623 1 + z −6
z = e jω
= [0.4 cos3ω − 0.3027 cos 2ω − 0.3027 cos 4ω + 0.0935 cos ω + 0.0935 cos5ω + 0.0623 + 0.0623 cos 6ω ]
+ j[ −0.4 sin 3ω + 0.3027 sin 2ω + 0.3027 sin 4ω − 0.0935 sin ω − 0.0935 sin 5ω − 0.0623 sin 6ω ]
Using the above equation, the frequency response H(ejw ) and magnitude function |H(ejw )| of highpass filter are calculated for various values
of w and listed in table 2. It is observed that the magnitude response obtained by both the methods are same.
Example 6.3
Design an FIR bandpass filter to pass frequencies in the range 1.5 kHz to 3 kHz and sampling frequency
of 8 kHz with 7 samples using Fourier series method. Determine the frequency response and verify the design by
sketching the magnitude response.
Solution
Given that, Fc1 = 1.5 kHz ; Fc2 = 3 kHz ; Fs = 8 kHz
Ω c1 2πFc1 2π × 1.5 × 103
∴ ω c1 = Ω c1T = = = = 0.375π
Fs Fs 8 × 103
Ω c2 2πFc2 2π × 3 × 103
ω c2 = Ωc2T = = = = 0.75π
Fs Fs 8 × 103
e j
Hd e jω = 1 ; for − ω c2 ≤ ω ≤ −ω c1 and ω c1 ≤ ω ≤ ω c2
= 0 ; otherwise
6. 33 Digital Signal Processing
The desired impulse response hd(n) of the bandpass filter is,
π − ω c1 ω c2
hd (n) =
1
2π z
−π
e j
Hd e jω e jωn dω =
1
2π z
− ω c2
1 × e jωn dω +
1
2π z
ω c1
1 × e jωn dω
=
1 LM e OP
jωn − ω c1
+
1 LM e OPjωn ω c 2
=
LM
1 e− jω c1n e− jω c2n
− +
OP
1 ejω c2n e jω c1n
−
LM OP
2π MN jn PQ −ω c2
2π MN jn PQ ω c1
2π MN
jn jn 2π jn PQ
jn MN PQ
=
1 e LM jω c 2n
−e − jω c 2n
−
e jω c1n
− e− jω c1n OP sinθ =
e jθ − e− jθ
πn MN 2j 2j PQ 2j
sin ω c2n − sin ω c1n
= ; for all n, except n = 0. When n = 0, the hd(n) become
πn
0/0, which is indeterminate.
∴ H(z) = z−3 h(3) z3 + h(2) z2 + h(1) z + h(0) + h(1)z−1 + h(2) z −2 + h(3) z −3 Using symmetry
condition,
= z−3 h(0) + h(1) z + z−1 + h(2) z2 + z−2 + h(3) z3 + z−3 h( n) = h(n)
= h(0) z−3 + h(1) z−2 + z−4 + h(2) z−1 + z−5 + h(3) z0 + z−6
The above equation can be used to draw the FIR filter structure as shown in fig 1.
−1 −2 −3
z X(z) z X(z) z X(z)
+ + +
−6 −5 −1
−4
z X(z) z X(z) z X(z)
−6 −1 −5 −2 −4 −3
0.1156[X(z) + z X(z)] −0.2716[z X(z) + z X(z)] −0.069[z X(z) + z X(z)] 0.375z X(z)
+ + +
F ig 1: L in ea r ph a se stru c tu re o f F IR b an d p a ss filter.
Frequency Response
When impulse response is symmetric and N is odd with centre of symmetry at n = 0, the magnitude
response |H(ejww )| is given by |A(w
w )|,
N−1
2
where, A(ω ) = h(0) + ∑ 2 h(n) cos ωn Refer table 6.2 case (v)
n = 1
3
= h(0) + ∑ 2 h(n) cos ωn
n =1
|H (e jω)|
2.0
1.8
1.6
1.4
1.2
1.0
0.8
0.6
0.4
0.2
ω
0
π 2π 3π 4π 5π 6π 7π 8π 9π 10 π 11π 12 π 13 π 14 π 15 π 16 π
16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16
( π/2 ) ( π)
F ig 2 : M a g n itu de resp on se o f F IR b a n d p ass filter.
Alternate Method for Frequency Response
e j
Frequency response, H e jω = H ( z)
z = e jω
e j
∴ H e jω = 0.375z −3 − 0.069 z −2 + z −4 − 0.2716 z −1 + z −5 + 01156
. 1 + z −6
z = e jω
= [0.375cos3ω − 0.069 cos 2ω − 0.069 cos 4ω − 0.2716 cos ω − 0.2716 cos5ω + 0.1156 + 01156
. cos 6ω ]
+ j[ −0.375 sin 3ω + 0.069 sin 2ω + 0.069 sin 4ω + 0.2716 sin ω + 0.2716sin 5ω − 01156
. sin 6ω ]
Chapter 6 - FIR Filters 6. 36
Using the above equation, the frequency response H(ejw ) and magnitude function |H(ejw )| of bandpass filter are calculated for various values
of w and listed in table 2. It is observed that the magnitude response obtained by both the methods are same.
Example 6.4
Design a FIR bandstop filter to reject frequencies in the range 1.5 kHz to 3 kHz and sampling frequency
of 8kHz with 7 samples using Fourier series method. Determine the frequency response and verify the design by
sketching the magnitude response.
Solution
Given that, Fc1 = 1.5 kHz ; Fc2 = 3 kHz ; Fs = 8 kHz
. × 103
Ω c1 2 πFc1 2π × 15
∴ ω c1 = Ω c1T = = = = 0. 375 π
Fs Fs 8 × 103
Ω c2 2πFc2 2π × 3 × 103
ω c2 = Ω c2T = = = = 0.75 π
Fs Fs 8 × 103
The desired frequency response Hd(ejw ) of bandstop filter is,
−ω c2 ω c1 π
=
1
2π z −π
1 × e jωn dω +
1
z
2π − ω
1 × e jωn dω +
c1
1
2π z
+ω c2
1 × ejωn dω
=
1 e LM jωnOP
−ω c2
+
1 e LM jωnOP
ω c1
+
LM
1 e jωn OP π
2π jn MN PQ −π
2π jn MN PQ − ω c1 MN
2π jn PQ ω c2
6. 37 Digital Signal Processing
∴ hd (n) =
LM
1 e − jω c2n e− jπn
− +
OP
1 ejω c1n e − jω c1n
− +
LM
1 e jπn ejω c2n
−
OP LM OP
MN
2π jn jn 2π jn PQ
jn 2π jn MN jn PQ MN PQ
=
1 Le
M
jπn
− e− jπn ejω c1n − e− jω c1n e jω c2n − e− jω c2n
+ −
OP e jθ − e− jθ
sinθ =
πn N 2j 2j 2j Q 2j
sin πn + sin ω c1n − sin ω c2n
= ; for all n, except n = 0
πn When n = 0, the
= 1−
FG ω c2 − ω c1 IJ ; for n = 0
H π K
N−1 7 −1
Here, N = 7, ∴ = =3
2 2
Since, the impulse response h(n) satisfies the symmetry condition, h(n) = h(n), calculate h(n) for n = 0 to 3.
When n = 0 ; h(0) = 1 −
FG ω c2 − ω c1
= 1−
IJ
0.75π − 0.375π FG
= 0.625
IJ
H π K π H K
sin (0.375π × 1) − sin(0.75π × 1)
When n = 1 ; h(1) = = 0.069
π ×1
sin (0.375π × 2) − sin(0.75π × 2)
When n = 2 ; h(2) = = 0.2716
π ×2
sin (0.375π × 3) − sin(0.75π × 3)
When n = 3 ; h(3) = = −0.1156
π×3
When n = −1 ; h(−1) = h(1) = 0.069
When n = −2 ; h(−2) = h(2) = 0.2716
When n = −3 ; h(−3) = h(3) = −0.1156
The transfer function H(z) of the digital bandstop filter is given by,
N−1
N−1 N−1
+ 3
2
− −
H(z) = z 2 l q
Z h(n) = z 2
∑ h(n) z−n = z−3 + ∑ h(n) z−n
N−1
n = − n = −3
2
= z−3 h( −3) z3 + h(−2) z2 + h(−1) z + h(0) z0 + h(1) z−1 + h(2) z−2 + h(3)z−3
Chapter 6 - FIR Filters 6. 38
∴ H(z) = z−3 h(3) z3 + h(2) z2 + h(1) z + h(0) + h(1) z−1 + h(2) z−2 + h(3)z−3 Using symmetry
condition,
= z−3 h(0) + h(1) z + z−1 + h(2) z2 + z−2 + h(3) z3 + z−3 h( n) = h(n)
Structure
Y(z)
Let , H(z) = = 0.625 z −3 + 0.069 z−2 + z−4 + 0.2716 z−1 + z−5 − 0.1156 1 + z −6
X(z)
∴ Y(z) = 0.625z−3 X(z) + 0.069 z−2 X(z) + z−4 X(z) + 0.2716 z −1 X(z) + z−5 X(z)
−1
z X(z) z −3X(z)
z
−1
z−1 z−1
+ + +
−1
−6
z −1 z −1 z
z X(z)
−3
−0.1156[X(z) + z−6X(z)]
−1 −5
0.2716[z X(z) + z X(z)] 0.069[z −2X(z) + z −4X(z)] 0.625z X(z)
+ + +
F ig 1 : L in ea r ph a se stru c ture of F IR ba n d sto p filte r.
Frequency Response
When impulse response is symmetric and N is odd with centre of symmetry at n = 0, the magnitude
function |H(ejww )| is given by |A(w
w )|,
N−1
2
where, A(ω ) = h(0) + ∑ 2 h(n) cos ωn Refer table 6.2 case (v)
n =1
3
A(ω ) = h(0) + ∑ 2 h(n) cos ωn
n =1
|H (e jω)|
1.3
1.2
1.1
1.0
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
ω
0 π 2π 3π 4π 5π 6π 7π 8π 9π 10 π 11π 12 π 13 π 14 π 15 π 16 π
16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16
( π/2 ) ( π)
F ig 2 : M a gn itu d e resp o n se o f F IR b a n d sto p filter.
e j
Frequency response, H e jω = H ( z)
z = e jω
e j
∴ H e jω = 0.625z −3 + 0.069 z −2 + z −4 + 0.2716 z −1 + z −5 − 01156
. 1 + z −6
z = e jω
e j
∴ H e jω = 0.625 cos3ω − j sin 3ω + 0.069 cos 2ω − j sin 2ω + cos 4ω − j sin 4ω
= [0.625cos 3ω + 0.069 cos 2ω + 0.069 cos 4ω + 0.2716 cos ω + 0.2716 cos5ω − 01156
. − 01156
. cos 6ω ]
+ j[ −0.625 sin 3ω − 0.069 sin 2ω − 0.069 sin 4ω − 0.2716 sin ω − 0.2716 sin 5ω + 0.1156 sin 6ω]
Using the above equation, the frequency response H(ejw ) and magnitude function |H(ejw )| of bandstop filter are calculated for various values
of w and listed in table 2. It is observed that the magnitude response obtained by both the methods are same.
6.8 Windows
The windows are finite duration sequences used to modify the impulse response of the FIR filters in
order to reduce the ripples in the passband and stopband, and also to achieve the desired transition from
passband to stopband.
The FIR filter design starts with desired frequency response, Hd(ejw ). The desired impulse response,
hd(n) is obtained by taking inverse Fourier transform of Hd(ejw ). The desired impulse response will be an
infinite duration sequence. On multiplying finite duration window sequence with infinite duration impulse
response, we get a finite duration impulse response with modified samples, which is used to design FIR filter.
The different types of window sequences discussed in this book are,
1. Rectangular window, wR(n)
2. Bartlett or Triangular window, wT(n)
3. Hanning window, wC(n)
4. Hamming window, wH(n)
5. Blackman window, wB(n)
6. Kaiser window, wK(n)
6. 41 Digital Signal Processing
Alternatively,
Rectangular window, w R (n) = 1 ; n = 0 to N − 1
.....(6.57)
=0 ; other n
The rectangular window sequence defined by equation (6.56) can be used only for odd values of N, but
the window sequence defined by equation (6.57) can be used for both odd and even values of N.
The frequency response or frequency spectrum of rectangular window WR(ejw ) is obtained by taking
Fourier transform of rectangular window sequence wR(n).
ωN
jω
sin 2
∴ WR (e ) = F {w R (n)} = ω
.....(6.58)
sin 2
Proof :
N−1
2 N −1 FG
− jω n −
N−1 IJ
H K
WR (e jω ) = F { w R (n)} = ∑ e− jωn = ∑e 2
n= −
N−1 n=0 Using finite
2
geometric series
N−1 jω
FG N − 1IJ jω
FG N − 1IJ N−1 sum formula,
H 2 K H 2 K
= ∑ e− jωn e = e ∑e − jωn
N −1
1 − CN
n= 0 n=0 ∑C
n=0
n
=
1− C
− jωN jωN − jωN − jωN
jω
FG N − 1IJ − jωN jω
FG N − 1IJ
H 2 K 1 − e H 2 K e 2 e 2 − e 2 e 2
= e = e
1 − e− jω − jω jω − jω − jω
e 2 e2 − e 2 e 2
The magnitude and log-magnitude response of rectangular window for N = 31 are shown in fig 6.22(c)
and (d). The spectrum of WR(ejw ) has two features that are important, they are the width of the main-lobe and
side-lobe amplitude. The main-lobe width is defined as the distance between the two points closest to w = 0
where |WR(ejw )| in dB is zero. For the rectangular window the main-lobe width is equal to 4p/N. The maximum
side-lobe magnitude for WR(ejw ) occurs for the first side-lobe and is equal to approximately -13 dB.
The magnitude response |H(ejw )| and log-magnitude response of the lowpass filter designed using
rectangular window are shown in fig 6.22(e) and (f). The approximated filter response differs from the ideal
desired response in several ways. The sharp transition in the ideal response at w = w c has been converted into
a gradual transition. In the passband a series of overshoots and undershoots occur. In the stopband the ideal
desired response is zero, but the FIR filter has a nonzero response called leakage. These features can be
explained in terms of the features of the window spectrum.
Chapter 6 - FIR Filters 6. 42
N = 31
N = 31 N = 31
w
4π
N
F ig a : R ecta ng u lar w in d ow seq uen ce. F ig b : A m plitud e respo nse F ig c: M ag nitud e respo nse o f
o f recta ng u lar w ind ow. recta ng u lar w ind ow.
N = 31 N = 31
−13 dB N = 31 ωc =0.5 π rad/sam ple ωc =0.5 π rad/sam ple
jω
|H d (e )|
F ig d : L og -m a g nitu d e resp o nse F ig e: M ag nitud e respo nse o f F IR low pa ss F ig f: L og -m a g nitu d e resp o nse of F IR low pa ss
o f recta ng u lar w ind ow. filter d esig ned u sin g rectang ula r w in do w. filter d esig ned u sin g rectang ula r w in do w.
The main-lobe of WR(ejw ) causes the smearing of the desired transfer function features. The discontinuity in
Hd(e ) is converted into a gradual transition in H(ejw ). The width of the transition region is related to the width
jw
of the main-lobe of WR(ejw ). Since the main-lobe width of WR(ejw ) is equal to 4p/N, the size of this transition
region can be reduced to any desired size by increasing the size (N), of the window sequence. The increase in N
also increases the number of computations necessary to implement the FIR filter.
Since the side-lobes of WR(ejw ) extend over a wide frequency range, large magnitude components in
Hd(e ) becomes smeared over a wide range of frequencies in H(ejw ). In the passband this side-lobe effects appear
jw
both as overshoots and undershoots to the desired response. In the stopband, these effects appear as a
nonzero response. These side-lobe effects do not diminish significantly, but remain almost constant as the
duration of rectangular window is increased.
It is observed that whatever be the number of elements of hd(n) included in the h(n), the magnitudes of the
overshoot and leakage will not change significantly, when the rectangular window is used. This result is known as
the Gibbs phenomenon, after the American Mathematician Josiak Willard Gibbs of Yale, who first noted this effect.
To reduce these side-lobe effects, we must consider alternate window sequences having spectrum exhibiting
smaller side-lobes. We can observe that the side-lobes of the window spectrum W(ejw ) represent the contribution
of the high frequency components in the window sequence. For the rectangular window, these high frequency
components are due to the sharp transitions from 0 to 1 at the edges of window sequence. Hence the amplitudes
of these high frequency components, (i.e., the side-lobe level) can be reduced by replacing these sharp transitions
by more gradual ones. This is the motivation for development of the triangular window, cosine window, etc.
6. 43 Digital Signal Processing
Alternatively,
N−1
2 n−
2
Triangular window , w T ( n) = 1− N−1
; for n = 0 to N − 1
.....(6.60)
=0 ; other n
The triangular window sequence defined by equation (6.59) can be used only for odd values of N, but
the window sequence defined by equation (6.60) can be used for both odd and even values of N.
The frequency response or frequency spectrum of triangular window WT(ejw ) is obtained by taking
Fourier transform of triangular window sequence wT(n).
F sin eωe jj I
N−1
2
) = F lw ( n)q = G
GG sin JJJ
4 .....(6.61)
∴ WT ( e jω T ω
H K
2
N = 31 N = 31
N = 31
8π
N
N = 31 N = 31 N = 31
ωc =0.5 π rad/sam ple ωc =0.5 π rad/sam ple
−25 dB jω
|H d (e )|
F ig d : L og -m a g nitu d e resp o nse F ig e: M ag nitud e respo nse o f F IR low pa ss F ig f: L og -m a g nitu d e resp o nse of F IR low pa ss
o f B artlett w in do w. filter d esig ned u sin g B artlett w ind ow. filter d esig ned u sin g B artlett w ind ow.
The magnitude and log-magnitude response of triangular window for N = 31 are shown in fig 6.23(c) and
(d). In log-magnitude response of triangular window the first side-lobe level is smaller than that of the rectangular
window, being reduced from –13 to – 25 dB. But the mainlobe width is 8p/N or twice that of the rectangular
window having the same duration. This result illustrates that there is a trade off between main-lobe width and
sidelobe level.
The magnitude response |H(ejw )| and log-magnitude response of the lowpass filter designed using
triangular window are shown in fig 6.23(e) and (f). The triangular window produces a smoother magnitude response
for FIR filter. The transition from passband to stopband is not as steep as that for FIR filters designed using the
rectangular window. In the stopband, the response is smoother, but the attenuation is less than that produced by
the rectangular window. Because of these characteristics the triangular window is not usually a good choice.
w RC ( n) = a + (1 − a) cos e j ; for n = −
2 πn
N−1
N−1
2
to +
N−1
2
.....(6.62)
= 0 ; other n
Alternatively,
w RC ( n) = a − (1 − a) cos e j ; for n = 0 to N − 1
2 πn
N−1 .....(6.63)
= 0 ; other n
The raised cosine window sequence defined by equation (6.62) can be used only for odd values of N, but
the window sequence defined by equation (6.63) can be used for both odd and even values of N.
The frequency response or frequency spectrum of raised cosine window WRC(ejw ) is obtained by taking
Fourier tansform of raised cosine window sequence wRC(n).
jω
l
∴ WRC ( e ) = F w RC ( n) = a q sin
ωN
2
+
1 − a sin e ωN
2
−
πN
N −1 j
ω
sin 2
2 sin e ω
−
π
2 N −1 j
sin e j
ωN πN
+
1− a 2 N −1
+ .....(6.64)
sin e j
2 ω π
+
2 N −1
Proof :
+∞
m
WH (e jω ) = F w RC( n) = r ∑ wRC(n) e jωn
n = ∞
N1
2
IJ O e jωn UUsing equation (6.62)U
= ∑ LNMa + (1 a)cosFGH 2πn
N1 K QP
N1
n=
2
L
N1 F FG N1 IJ I O FG N1 IJ
= ∑ MMa + (1 a) cosG K P
2π n jω n
H 2 JJ P e H 2 K
NM
n=0 GH N1
K PQ
6. 45 Digital Signal Processing
N1 FG N 1IJ
∑ LMNa + (1 a) cose π jO e
jω
∴ WH (e jω ) =
2 πn jωn H 2 K
n=0
PQ N1
e
cos(θ π) = cosθ
FG IJN1 N1
jω
FG N 1IJ N1 jω
FG N 1IJ N1
e jθ + e− jθ
H 2 K jωn H 2 K e je
2 πn jωn cosθ =
= ae ∑e (1 a) e ∑ cos
N1 2
n=0 n=0
F N 1IJ
jω G
H 2 K
N1 F N 1IJ
jω G
H 2 K
N1 LM j2πn − j2πn
OP
= ae ∑ e jωn (1 a) e ∑ MN e N1 + eN 1 PQ e
jωn
n=0 n=0
2
F N 1IJ
jω G N1
H 2 K
= ae ∑ e jωn
n=0
F N 1IJ LM j2 πn − j2 πn OP
1 a jω GH
N1 N1
2 K
e N 1 e jωn + e N 1 e jωn
2
e
MN ∑
n=0
∑
n=0 PQ
F N 1IJ
jω G N1
H 2 K
= ae ∑ (e jω )n
n=0
F N 1IJ LM F FG 2π IJ I n F FG 2π IJ I n O
1 a jω GH K J PP
N1 −j ω N1 −j ω +
2
e 2 K
MM ∑ GG e H N1 KJ +
JK ∑ GG e H N1
JK P
n=0
N H n=0 H Q
jω
FG N 1IJ
H 2 K 1 e jωN
= ae
1 e jω
Using finite
jω
FG N 1IJ LM FGH j ω
IJ
2π
K N
FG 2π IJ N O
H N 1K P
j ω + geometric series
1 a H 2 K N1
2
e MM1 e FG j ω
2π I
J
+
1 e
F 2π IJ PP
jG ω +
sum formula,
N −1
N1 e H N 1K 1 e H N 1K Q ∑C n
=
1 − CN
n=0 1− C
jωN F jωN jωN I
e 2 GG e 2 e 2 JJ
jω
FG N −1IJ GH JK
= ae H 2K e jθ e− jθ = 1
jω F jω jω I
e 2 GG e 2 e 2 JJ
GH JK
FG
j ω
2π N IJ F FGH j ω
2π N IJ FG
j ω
2π NIJ I
F N − 1IJ e H N1 2 K GG e N1 2 K e H N1 2 K JJ
1 a jω GH
e 2 K H K
2 FG
j ω
H
2π 1 IJ
K
F FGH j ω
2π 1 IJ
K
FG
j ω
H
2π 1IJ I
K J
e N1 2 GG e N1 2
e N1 2
JK
H
FG
j ω +
2π N IJ F FGH j ω+
2π N IJ j ω +
FG 2π N IJ I
F N − 1IJ e
H N1 2 K GG e N1 2 K e H N1 2 K J
JK
1 a jω GH
e 2 K H
2 FG
j ω +
2π 1 IJ F FGHj ω+
2π 1 IJ FG
j ω +
2π 1 IJ I
e H N1 2 K GG e N1 2 K e H N1 2 K J
JK
H
Chapter 6 - FIR Filters 6. 46
LM jω FG N − 1IJ − jωN
+
jω OP sinωN
a eN
H 2 K Q e jθ − e− jθ
∴ WH e e j= jω 2 2 2
sin ω
sin θ =
2j
2
1 a MN jω GH
L F N − 1IJ − jFG ω + 2π IJ N + jFG ω + 2π IJ 1 OP sinFH e ω+
2π N
j IK
2 K H N 1K 2 H N 1K 2 Q N1 2
e
2 sinFH e j IK
2π 1
ω+
N1 2
LM jωN jω
jωN
+
jω OP sin ωN
= a eN 2 2 2 2 Q 2
ω
sin
2
L jωN jω jωN jπN jω jπ OP e
sin ωN πN
j
1 a MN 2 2
2
+
N−1
+
2
−
N−1 Q 2
−
N−1
e
2 sine ω
−
π
j
2 N−1
= a
sin ωN
2
jπ ωN
1 a N 1(N 1) sin 2 −
e
e πN
N−1 j
ω
sin
2
2 sin ω − e 2
π
N−1 j e ± jπ = − 1
e
jπ ωN
1 a N 1(N 1) sin 2 + e πN
N−1
j
2 sin ω + e 2
π
N−1
j
= a
sin ωN
2
+
ωN
1 − a sin 2 − e πN
N−1
j +
ωN
1 a sin 2 + e πN
N−1
j
ω
sin
2
2 sin ω − e 2
π
N−1
j 2 sin ω + e 2
π
N−1
j
6.8.4 Hanning Window
The Hanning window is one type of raised cosine window. The equation for Hanning window sequence
wC(n) is obtained by putting a = 0.5 in equations (6.62) and (6.63).
2 πn N−1 N−1
Hanning window, w C ( n) = 0.5 + 0.5 cos N − 1 ; for − 2
to + 2
=0 ; other n .....(6.65)
Alternatively,
2 n π
Hanning window , w C ( n) = 0.5 − 0.5 cos N − 1 ; for n = 0 to N − 1
.....(6.66)
=0 ; other n
The Hanning window sequence defined by equation (6.65) can be used only for odd values of N, but the
window sequence defined by equation (6.66) can be used for both odd and even values of N.
The frequency response or frequency spectrum of Hanning window WC(ejw ) is obtained by taking
Fourier transform of Hanning window sequence wC(n), which can also be obtained from equation (6.64) by
putting a = 0.5.
6. 47 Digital Signal Processing
jω
l
∴ WC ( e ) = F w C ( n) = 0.5 q sin
ωN
2
+ 0.25
e sin
ωN
2
−
πN
N −1 j
ω
sin e j
ω π
sin 2
−
2 N −1
sin e j
ωN πN
+
2 N −1
+ 0.25
sin e .....(6.67)
ω
+
π
2 N −1 j
N = 31 N = 31
N = 31
8π
N
F ig a : H a n nin g w in do w seq uen ce. F ig b : A m plitud e respo nse o f H a nn ing w in do w. F ig c: M ag nitud e respo nse o f
H a nn in g w in do w.
N = 31
N = 31 N = 31 ωc =0.5 π rad/sam ple
ωc =0.5 π rad/sam ple
−31 dB
|H d (e jω)|
F ig d : L og -m ag nitud e respo nse F ig e: M ag nitud e respo nse o f F IR low pa ss F ig f: L og -m ag nitud e respo nse o f F IR low pa ss
o f H a nn in g w in do w,. filter d esig ned usin g H an n ing w ind ow. filter d esig ned usin g H an n ing w ind ow.
The magnitude and log-magnitude response of Hanning window for N =31 are shown in fig 6.24(c) and (d).
In the log-magnitude response of WC(ejw ) the magnitude of the first side-lobe is –31 dB. An improvement of 6 dB
over the triangular window. When compared to triangular window, the main-lobe width is same but the magnitude
of side-lobe is reduced, hence the Hanning window is preferrable to triangular window.
The magnitude response |H(ejw )| and log-magnitude response of the lowpass filter designed by using
Hanning window are shown in fig 6.24(e) and (f). Most notable is the improved stopband attenuation characteristic.
The largest peak is approximately 44 dB relative to the passband level. At higher frequencies the stopband
attenuation is even greater.
Hamming noted that a reduction in the first side-lobe level can be achieved by adding a small constant
value to the raised cosine window. The equation for Hamming window sequence wH(n) is obtained by putting
a = 0.54 in equations (6.62) and (6.63).
Chapter 6 - FIR Filters 6. 48
π −1 N−1
∴ Hamming window, w H ( n) = 0.54 + 0.46 cos N2 −n1 ; for n = − N 2 to +
2
=0 ; other n .....(6.68)
Alternatively,
2 πn
Hamming window, w H ( n) = 0.54 − 0.46 cos N − 1 ; for n = 0 to N − 1
.....(6.69)
=0 ; other n
The Hamming window sequence defined by equation (6.68) can be used only for odd values of N, but the
window sequence defined by equation (6.69) can be used for both odd and even values of N.
The frequency response or frequency spectrum of Hamming window WH(ejw ) is obtained by taking Fourier
transform of Hamming window sequence wH(n), which can also be obtained from equation (6.64) by putting a = 0.54.
jω
∴ WH (e ) = F w H ( n) = 0.54l q sin
ωN
2
+ 0.23
e sin
ωN
2
−
πN
N −1 j
ω
sin e j
ω π
sin 2
−
2 N −1
sin e j
ωN πN
+
2 N −1
+ 0.23
sin e .....(6.70)
ω
+
π
2 N −1 j
N = 31 N = 31
N = 31
8π
N
N = 31 N = 31
N = 31
ωc=0.5 π rad/sam ple
ωc=0.5 π rad/sam ple
−41 dB
|H d (e jω)|
F ig d : L og -m a g nitu d e resp o nse F ig e: M ag nitud e respo nse o f F IR low pa ss filter F ig f: L og -m a g nitu d e resp o nse of F IR low pa ss
o f H a m m in g w in do w,. d esig ned u sin g H am m in g wind ow. filter d esig ned u sin g H am m ing w ind ow.
The magnitude and log-magnitude response of hamming window for N = 31 are shown in fig 6.25(c) and (d).
Hamming reduced the side-lobe magnitude while maintaining the main-lobe width, equal to 8p/N. The magnitude
of the first side-lobe has been reduced to –41dB, an improvement of 10 dB relative to the Hanning window. But this
improvement is achieved at the expense of the side-lobe magnitudes at higher frequencies, which are almost
constant with frequency. [With the Hanning window, the side-lobe amplitudes decrease with frequency].
The magnitude response |H(ejw )| and log-magnitude response of lowpass filter designed using the Hamming
window are shown in fig 6.25(e) and (f). It is noted that the first side-lobe peak is reduced to –51 dB, an
improvement of 7 dB relative to the Hanning window filter. However, as the frequency increases, the stopband
attenuation does not increase as much as with the filter produced by the Hanning window.
The stopband attenuation in the lowpass filter magnitude response is limited by the side-lobe level of the
window function. Even though the Hamming window achieved an attenuation of 51 dB (or gain of –51 dB) in the
stopband for our lowpass filter, it may not be sufficient for some applications.
2 πn 4 πn N–1 N–1
Blackman window, w B ( n) = 0.42 + 0.5 cos N–1
+ 0.08 cos N–1
; for – 2
to + 2
=0 ; other n .....(6.71)
Alternatively,
2 πn 4 πn
Blackman window, w B ( n) = 0.42 − 0.5 cos N–1
+ 0.08 cos N–1
; for n = 0 to N – 1
.....(6.72)
=0 ; other n
The Blackman window sequence defined by equation (6.71) can be used only for odd values of N, but the
window sequence defined by equation (6.72) can be used for both odd and even values of N.
The frequency response or frequency spectrum of Blackman window WB(ejw ) is obtained by taking
Fourier tranform of Blackman window sequence wB(n).
jω
l q
∴ WB ( e ) = F w B ( n) = 0.42
sin
ωN
2
+ 0.25
sine ωN
2
−
Nπ
N −1 j + 0.25 sin e ωN
2
+
Nπ
N −1 j
ω
sin e j sin e j
ω π ω π
sin 2
− +
2 N −1 2 N −1
The magnitude and log-magnitude response of Blackman window for N = 31 are shown in fig 6.26(c)
and (d). In Blackman window the width of main-lobe is 12p/N, which is highest among windows. It can be
observed that the magnitude of the first side-lobe is –58 dB and the side-lobe magnitude decreases with frequency.
This desirable feature is achieved at the expense of increased main-lobe width. However, the main-lobe width can
be reduced by increasing the value of N.
The magnitude response |H(ejw )| and log-magnitude response of lowpass filter designed using blackman
window are shown in fig6.26 (e) and (f). It is observed at the first side-lobe peak is –78 dB, an improvement of 27
dB relative to Hamming window filter. However, as the frequency increases, the stopband attenuation does not
increase as much as with the filter produced by the Hanning window.
Chapter 6 - FIR Filters 6. 50
N = 31
N = 31
N = 31
12 π
N
F ig a : B la ckm an w ind o w sequ ence. F ig b : A m plitud e respo nse F ig c: M ag nitud e respo nse o f
o f B la ckm a n w ind ow. B la ckm a n w ind o w.
N = 31
N = 31 N = 31
ωc =0.5 π rad/sam ple
ωc =0.5 π rad/sam ple
|H d (e jω)|
−58 dB
F ig d : L og -m ag nitu d e respo nse F ig e: M ag nitud e respo nse o f F IR low pa ss F ig f: L og -m ag nitu d e respo nse of F IR low pa ss
o f B la ckm an w ind ow,. filter d esig ned u sin g B la ckm an w in do w. filter d esig ned u sin g B la ckm an w in do w.
=0 ; other n .....(6.74)
where, β1 = a 1 –
LM e j OP
2n
2
0.5
N Q
N–1
Alternatively,
I 0 (β2 )
Kaiser window function, w K ( n) = I0 (a2 )
; for n = 0 to N − 1
.....(6.75)
=0 ; other n
where, β 2 = a
LMe j − en −
N–1
2
N–1 2
j OPQ
0.5
; a2 = a
N–1
N 2 2 2
The Kaiser window sequence defined by equation (6.74) can be used only for odd values of N, but the
window sequenced defined by equation (6.75) can be used for both odd and even values of N.
The parameter "a" is an independent variable that can be varied to control the side-lobe levels with
respect to the main-lobe peak. The modified Bessel function of the first kind I0(x) is given by,
6. 51 Digital Signal Processing
LMb0.5xg2 OP k
L FG IJ k O
∞ 2 ∞
= 1+ ∑ N Q
1 x
I 0 ( x) = 1 + ∑ MN k! 2H K PQ b k !g 2
k=1 k=1
∞ FH 0.25x2 IK k 0.25x 2
FH 0.25x2 IK 2 FH 0.25x2 IK 3 .....(6.76)
= 1 + ∑ b k!g2
= 1+
b1!g2
+
b2!g2
+
b3!g2
+.....
k=1
The series of equation (6.76) can be used to compute I0(b1), I0(a), I0(b2), I0(a2) and can be computed for any
desired accuracy. Usually 25 terms of the series are sufficient for most practical purposes.
The frequency response or frequency spectrum of Kaiser window, WK(ejw ) is obtained by taking Fourier
transform of Kaiser window sequence wK(n).
F N −1 F F II
2a
2 0.5 I
2
sin GH 2
GH GH JK JK
ω2 −
N −1 JK
∴ WK (e jω ) = F w K ( n) = l q I0 (a) F 2 F 2 a I 2 I 0.5 .....(6.77)
GH ω − GH N −1JK JK
Fig 6.27 to 6.29 shows the Kaiser window sequence and its frequency response for three different values
of "a". With increase in value of "a" the magnitude of first side-lobe reduces, but the width of main-lobe
increases. The width of the main-lobe can be reduced by increasing the length N of the window sequence. In the
lowpass filter designed using Kaiser window the stopband attenuation increases with increase in the value
of "a".
N = 31 N = 31
N = 31
N = 31 N = 31
N = 31 ωc =0.5 π rad/sam ple ωc =0.5 π rad/sam ple
jω
|H d (e )|
F ig d : L og -m a g nitu d e resp o nse F ig e: M ag nitud e respo nse o f F IR low pa ss F ig f: L og -m a g nitu d e resp o nse of F IR low pa ss
o f K a iser w ind ow. filter d esig ned u sin g K a iser w in do w. filter d esig ned u sin g K a iser w in do w.
N = 31 N = 31
N = 31
N = 31 N = 31
N = 31
ωc =0.5 π rad/sam ple ωc =0.5 π rad/sam ple
jω
|H d (e )|
F ig d : L og -m a g nitu d e resp o nse F ig e: M ag nitud e respo nse o f F IR low pa ss F ig f: L og -m a g nitu d e resp o nse of F IR low pa ss
o f K a iser w ind ow. filter d esig ned u sin g K a iser w in do w. filter d esig ned u sin g K a iser w in do w.
N = 31 N = 31
N = 31
N = 31 N = 31
N = 31 ωc =0.5 π rad/sam ple ωc =0.5 π rad/sam ple
|H d (e jω)|
F ig d : L og -m a g nitu d e resp o nse F ig e: M ag nitud e respo nse o f F IR low pa ss F ig f: L og -m a g nitu d e resp o nse of F IR low pa ss
o f K a iser w ind ow,. filter d esig ned u sin g K a iser w in do w. filter d esig ned u sin g K a iser w in do w.
− N −1
w R ( n) = 1 ; for n = − N2 1 to +
2
= 0 ; other n
Rectangular w R ( n) = 1 ; for n = 0 to N − 1
= 0 ; other n
2 |n | N −1 N −1
w T ( n) = 1 − N −1
; for n = − 2
to +
2
Triangular =0 ; other n
2|n − ( N −1)/ 2|
w T ( n) = 1 − N −1
; for n = 0 to N − 1
=0 ; other n
2πn N −1 N −1
w C ( n) = 05
. + 05
. cos N −1
; for n = − 2
to +
2
=0 ; other n
Hanning
2πn
w C ( n) = 05
. − 05
. cos N −1 ; for n = 0 to N − 1
=0 ; other n
2πn N −1 N −1
w H ( n) = 054
. + 0.46 cos N −1
; for n = − 2
to +
2
=0 ; other n
Hamming 2πn
w H ( n) = 054
. − 046
. cos N −1 ; for n = 0 to N − 1
=0 ; other n
2πn 4πn N −1 N −1
w B ( n) = 0.42 + 05
. cos N −1
+ 0.08 cos N −1
; for n = − 2
to +
2
=0 ; other n
Blackman
2πn 4πn
w B ( n) = 0.42 − 05
. cos N −1 + 0.08 cos N −1
; for n = 0 to N − 1
=0 ; other n
I 0 (β1 ) N −1 N −1
w k ( n) = ; for n = − 2
to +
2
I 0 (a)
=0 ; other n
where, β1 = a LM
1−
FG 2 n IJ 2 OP 0.5
N H N −1 K Q
I 0 (β 2 )
w K ( n) = ; for n = 0 to N − 1
I 0 (a 2 )
Kaiser =0 ; other n
N 2
N −1
a2 = a 2
Chapter 6 - FIR Filters 6. 54
K ais er (a = 4.5)
H anning
F ig 6 .3 0 : S h a p es o f va rio u s w in do w fu n ctio n s.
Table 6.5 : Frequency - Domain Characteristics of Some Window Functions
π ωc
Lowpass filter H d ( e jω
R|e
|
) = S0
− jωα
;
;
– ωc ≤ ω ≤ + ωc
– π ≤ ω < – ωc
h d ( n) =
1
2π z
−π
H d (e jω ) e jωn dω =
1
2π z
−ω c
e –jωα e jωn dω
||0 ; ωc < ω ≤ π jω
Q H d (e ) = 0 in the range − π ≤ ω < −ω c and + ω c < ω ≤ + π
T
+π –ω c π
Highpass filter H d ( e jω
R|e
|
) = Se
− jωα
− jωα
;
;
– π ≤ ω ≤ – ωc
ωc ≤ ω ≤ π
h d ( n) =
1
2π z
−π
H d (e jω ) e jωn dω =
1
2π z
−π
e –jωα e jωn dω +
1
2π z
ωc
e − jωα e jωn dω
Bandpass filter H d ( e jω ) = S0
||e
|
− jωα
;
;
;
– ω c2 ≤ ω ≤ – ω c1
ωc1 ≤ ω ≤ ω c2
– π ≤ ω < –ω c2
h d ( n) =
1
2π
−π
z jω
H d (e ) e jωn
dω =
1
2π z
−ω c 2
e –jωα
e jωn
dω +
1
2π z
ω c1
e − jωα e jωn dω
− jωα
;
;
–π ≤ ω ≤ –ω c2
– ωc1 ≤ ω ≤ +ω c1
h d ( n) =
1
2π z
−π
H d (e jω )e jωn dω =
1
2π z
−π
e jωα e jωndω +
1
2π z
− ω c1
e − jωα e jωn dω +
1
2π z
ω c2
e − jωα e jωn dω
h d ( n) =
1
2π z
+π
−π
H d ( e jω ) e jωn dω
n=0
h d ( n) =
1
2π z
+π
−π
H d ( e jω ) e jωn dω
The impulse response is symmetric with centre of symmetry at n = 0, and so h(–n) = h(n).
Hence it is sufficient if we calculate h(n) for n = 0 to (N – 1)/2.
6. 57 Digital Signal Processing
4. Take Z-transform of the impulse response h(n) to get the noncausal transfer function of FIR
filter, HN(z).
N −1
+
2
∴ H N (z) = Z h(n) =l q ∑ h( n) z N −1
−n
n =−
2
5. Convert the noncausal transfer function, HN(z) to causal transfer function, H(z) by multiplying
HN(z) by z – (N – 1)/2.
N −1 Applying symmetry
+
−
N −1 2 condition, h(– n) = h(n)
∴ Transfer function, H(z) = z 2 ∑ h ( n ) z −n
Refer equation (6.55).
N −1
n =−
2
−
N −1
LM N −1
2
OP
Alternatively, Transfer function, H(z) = z 2
MMh(0) + ∑ h(n) z
n=1
n
+z −n
PP
N Q
6. Draw a suitable structure for realization of FIR filter.
Design verification
1. Determine the frequency response, H(ejw ).
Method - 1 : Choose a linear phase magnitude function |H(ejw )| from table 6.2. Using h(n),
obtain an equation for |H(ejw )|.
Method - 2 : The frequency response, |H(ejw )| can be obtained by replacing z by ejw in the
transfer function, H(z).
∴ Frequency response, H e jω = H ( z) e j z = e jω
Example 6.5
Design a linear phase FIR lowpass filter using rectangular window by taking 7 samples of window sequence
and with a cutoff frequency, w c = 0.2p rad/sample.
Solution
Let us choose symmetric impulse response with symmetry condition h(N 1 n) = h(n). Therefore, the
desired ideal frequency response Hd(ejw ) for FIR lowpass filter is,
Hd (ejω ) = e− jωα ; ω c ≤ ω ≤ +ω c
=0 ; otherwise
The desired impulse response hd(n) is obtained by taking inverse Fourier transform of Hd(ejw ).
By definition of inverse Fourier transform,
+π +ω c
hd (n) =
1
2π z
−π
jω
Hd (e ) e jωn
dω =
1
2π z
−ω c
e− jωα e jωn dω
+ω c
LM e OP +ω c
LM e OP
=
1
2π z
−ω c
ejω(n − α)
dω =
1
2π
jω (n − α )
MN j(n − α) PQ −ω c
=
1
2π
jω c (n − α )
MN j(n − α)
−
e− jω c (n − α )
j(n − α) PQ
Chapter 6 - FIR Filters 6. 58
∴ hd (n) =
1 LM e jω c (n − α )
− e− jω c (n − α) OP e jθ − e− jθ
sinθ =
π(n − α ) MN 2j PQ 2j
sin ω c (n − α ) When n = a, the hd(n) becomes
= ; for all n, except n = α
π(n − α ) 0/0, which is indeterminate.
sin ω c (n − α )
∴ When n = α ; hd (n) = Lt U sin g L' Hospital rule,
(n − α ) → 0 π(n − α )
sin Aθ
1 sin ω c (n − α ) 1 ω Lt =A
= Lt = × ωc = c θ→ 0 θ
π (n − α ) → 0 (n − α ) π π
The impulse response h(n) of FIR filter is obtained by multiplying hd(n) by window sequence.
= h(0) + h(1) z−1 + h(2) z−2 + h(3) z −3 + h(4) z −4 + h(5) z −5 + h(6) z −6 Using symmetry
−1 −2 −3 −4 −5 −6 condition,
= h(0) + h(1) z + h(2) z + h(3) z + h(2) z + h(1) z + h(0) z
h(N 1 n) = h(n).
= h(0) 1+ z −6 + h(1) z−1 + z−5 + h(2) z−2 + z−4 + h(3) z−3
Structure
Y(z)
Let , H(z) = = 0.1009 1 + z−6 + 0.1514 z−1 + z−5 + 0.1871 z−2 + z−4 + 0.2z −3
X(z)
∴ Y(z) = 0.1009 X(z) + z −6 X(z) + 0.1514 z−1X(z) + z−5 X(z) + 0.1871 z −2X(z) + z−4 X(z) + 0.2z−3 X(z)
The above equation can be used to draw the FIR filter structure as shown in fig 1.
6. 59 Digital Signal Processing
+ + +
−6 −1 −5 −2 −4 −3
0.1009 [X(z)+z X(z)] 0.1514 [z X(z)+z X(z)] 0.1871 [z X(z)+z X(z)] 0.2 z X(z)
+ + +
F ig 1 : L in e ar p h a se stru cture o f F IR lo w pa ss filte r.
Frequency Response
When impulse response is symmetric and N is odd with centre of symmetry at (N 1)/2, the magnitude
response |H(ejww )| is given by |A(w
w )|,
N −1
2
Refer table 6.2 case (i)
where, A(ω ) = h e j + ∑ 2he
N− 1
2
n=1
N− 1
2 j cos ωn
− n
3
∴ A(ω ) = h(3) + ∑ 2 h(3 − n) cos ωn
n=1
|H (e jω)|
1.1
1.0
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
ω
0 π 2π 3π 4π 5π 6π 7π 8π 9π 10 π 11π 12 π 13 π 14 π 15π 16 π
16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16
( π/2 ) ( π)
F ig 2 : M a g n itu de resp on se o f F IR lo w p ass filter.
H d (e jω ) = 1 ; – ω c ≤ ω ≤ +ω c
= 0 ; otherwise
The desired impulse response hd(n) is obtained by taking inverse Fourier transform of Hd(ejw ).
h d ( n) =
1
2π z
−π
H d (e jω ) e jωn dω =
1
2π z
−ω c
1 × e jωn dω
=
1 LM e
jωn OP +ω c
=
1 LM e jω c n
−
e−
jω c n OP sinθ =
e jθ − e − jθ
2π MN jn PQ −ω c
2π MN jn jn PQ 2j
=
1 LM ejω c n
− e − jω c n OP = sin ω n c
; for all n, except n = 0
When n = 0, the hd(n) become
πn MN 2j PQ πn 0/0, which is indeterminate.
sin ω c n
∴ When n = 0 ; h d ( n) = Lt U sin g L' Hospital rule,
n→0 πn
sin Aθ
1 sin ω c n 1 ω Lt =A
= Lt = × ωc = c θ→ 0 θ
π n→0 n π π
The impulse response h(n) of FIR filter is obtained by multiplying hd(n) by window sequence.
N −1 N −1
Rectangular window sequence, w R ( n) = 1 ; for n = − 2
to + 2
= 0 ; otherwise
Since, h(n) satisfies the symmetry condition h(–n) = h(n), calculate h(n) for n = 0 to 3.
ω c 0.2 π
When n = 0 ; h(0) = = = 0.2
π π
sin ( 0.2 π × 1)
When n = 1 ; h(1) = = 0.1871
π ×1
sin ( 0.2 π × 2)
When n = 2 ; h(2) = = 0.1514
π×2
sin (0.2 π × 3)
When n = 3 ; h(3) = = 0.1009
π×3
bg
When n = −1 ; h( −1) = h 1 = 0.1871
N −1
N −1 N −1 2 3
− −
H ( z) = z 2 l q
Z h(n) = z 2
∑ h( n) z – n = z −3
N −1
∑ h( n) z – n
n = −3
n =−
2
LM
= z −3 h(3) z 3 + z −3 + h(2) z 2 + z −2 + h(1) z + z −1 + h(0) OP
N Q
= h(3) z 0 + z −6 + h(2) z −1 + z −5 + h(1) z −2 + z −4 + h(0) z −3
It is observed that the transfer function obtained in both the methods are same.
e j
Frequency response, H e jω = H ( z)
z = e jω
e j
∴ H e jω = 0.1009 1 + z −6 + 01514
. z −1 + z −5 + 0.1871 z −2 + z −4 + 0.2 z −3
z = e jω
− j6ω − jω − j5ω − j2 ω − j4 ω
= 0.1009 1 + e + 01514
. e +e + 0.1871 e +e + 0.2 e − j3ω
+ j[ − 01009
. sin 6ω − 0.1514 sin ω − 01514
. sin 5ω − 01871
. sin 2ω − 01871
. sin 4ω − 0.2 sin 3ω ]
Using the above equation the frequency response H(ejw ) and magnitude function |H(ejw )| of lowpass filter are calculated for various values of
w and listed in table 2. It is observed that the magnitude response obtained by both the methods are same.
Chapter 6 - FIR Filters 6. 62
Example 6.6
Design a linear phase FIR highpass filter using hamming window, with a cutoff frequency, w c = 0.8p
rad/sample and N = 7.
Solution
Let us choose symmetric impulse response with symmetry condition h(N 1 n) = h(n). Therefore, the
desired ideal frequency response Hd(ejw ) for FIR highpass filter is,
Hd (e jω ) = e − jωα ; π ≤ ω ≤ −ω c and + ω c ≤ ω ≤ + π
=0 ; otherwise
The desired impulse response hd(n) is obtained by taking inverse Fourier transform of Hd(ejw ).
By definition of inverse Fourier transform,
π −ω c π
hd (n) =
1
2π z
−π
Hd (e jω ) e jωn dω =
1
2π z
−π
e − jωα e jωn dω +
1
2π z
ωc
e − jωα e jωn dω
−ω c π
=
1
2π z
−π
e jω (n − α ) dω +
1
2π z
ωc
e jω(n − α ) dω
=
LM
1 e jω (n − α ) OP −ωc
+
LM
1 ejω (n − α ) OP π
MN
2π j(n − α ) PQ −π MN
2π j(n − α ) PQ ωc
=
1LM e − jω c (n − α )
−
e− jπ(n − α ) OP +
1 LM e
jπ (n − α )
−
ejω c (n − α ) OP
2π MN j(n − α) j(n − α) PQ 2π MN j(n − α) j(n − α) PQ e jθ − e− jθ
sinθ =
2j
=
1 LM e jπ(n − α )
− e− jπ(n − α )
−
e jω c (n − α ) − e − jω c (n − α ) OP
π(n − α ) MN 2j 2j PQ
sin π(n − α ) − sin ω c (n − α )
= ; for all n, except n = α When n = a, the hd(n) becomes
π(n − α )
0/0, which is indeterminate.
6. 63 Digital Signal Processing
sin π(n − α ) − sin ω c (n − α )
When n = α ; hd (n) = Lt
(n − α ) → 0 π(n − α )
=
1 LM Lt
sin π(n − α )
− Lt
sin ω c (n − α ) OP
π N
(n − α ) → 0 (n − α ) (n − α ) → 0 (n − α ) Q U sin g L' Hospital rule,
1 sin Aθ
= (π − ω c ) Lt =A
π θ→ 0 θ
ω
= 1− c
π
The impulse response h(n) of FIR filter is obtained by multiplying hd(n) by window sequence.
The Hamming window sequence wH(n) is given by,
=0 ; otherwise
∴ h(n) = hd (n) wH(n)
=
b g
sin π n − α − sin ω c n − α b g 0.54 − 0.46 cos e j
2πn
; for n ≠ α
πn−α b g N− 1
= 1−
FG ωc IJ 0.54 − 0.46 cos e j
2πn
; for n = α
H π K N− 1
gL
−sinω c n − 3 b nπ O Since n and a are integers,
∴ h(n) =
bg MN0.54 − 0.46 cos 3 PQ ; for n ≠ 3
π n−3 sin (n a) p = 0.
L
−sin(0.8π (0 − 3)) M0.54 − 0.46 cos
0 × πO
N 3 PQ
When n = 0 ; h(0) = = −0.0081
π × (0 − 3)
When n = 3 ; h(3) = 1 −
FG 0.8π IJ LM0.54 − 0.46 cos 3 × π OP = 0.2
H π KN 3 Q
When n = 4 ; h(4) = h(6 − 4) = h(2) = −0.1441 Using symmetry condition
When n = 5 ; h(5) = h(6 − 5) = h(1) = 0.0469 h(N 1 n) = h(n) Þ h(6 n) = h(n).
= h(0) 1+ z−6 + h(1) z−1 + z−5 + h(2) z−2 + z−4 + h(3) z−3
= −0.0081 1+ z−6 + 0.0469 z−1 + z−5 − 0.1441 z−2 + z−4 + 0.2 z−3
Structure
Y(z)
Let , H(z) = = −0.0081 1+ z−6 + 0.0469 z−1 + z−5 − 0.1441 z−2 + z −4 + 0.2 z−3
X(z)
+ + +
0.2
−6 −1 −5 −2 −4 −3
−0.0081 [X(z)+z X(z)] 0.0469 [z X(z)+z X(z)] −0.1441 [z X(z)+z X(z)] 0.2 z X(z)
+ + +
F ig 1 : L in e ar p h a se stru ctu re o f F IR h ig hp a ss filte r.
Frequency Response
When impulse response is symmetric and N is odd with centre of symmetry at (N 1)/2, the magnitude
response |H(ejww )| is given by |A(w
w )|,
N− 1
2
where, A(ω ) = h e j + ∑ 2he
N −1
2
n=1
N− 1
2 j cos ωn
− n Refer table 6.2 case (i)
3
∴ A(ω ) = h(3) + ∑ 2 h(3 − n) cos ωn
n=1
|H (e jω)|
0.6
0.55
0.5
0.45
0.4
0.35
0.3
0.25
0.2
0.15
0.1
0.05
ω
0
π 2π 3π 4π 5π 6π 7π 8π 9π 10π 11π 12π 13π 14 π 15 π 16 π
16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16
( π/2 ) ( π)
F ig 2 : M a g n itu d e resp o nse of F IR h ig h p ass filter.
w A(w
w) |H(ejww )| = |A(w
w )| w A(w
w) |H(ejww )| = |A(w
w )|
0× π 9× π
16
0.0106 0.0106 16
0.1605 0.1605
1×π 10 × π
16
0.0094 0.0094 16
0.2289 0.2289
2×π 11×π
16
0.0061 0.0061 16
0.3083 0.3083
3×π 12× π
16
0.0005 0.0005 16
0.3923 0.3923
4× π 13× π
16
0.0076 0.0076 16
0.4723 0.4723
5×π 14 × π
16
0.0198 0.0198 16
0.5387 0.5387
6× π 15× π
16
0.0383 0.0383 16
0.5827 0.5827
7× π 16 × π
16
0.0661 0.0661 16
0.5982 0.5982
8× π
16
0.1062 0.1062
Let the symmetry condition be h(– n) = h(n). Therefore, the desired ideal frequency response Hd(ejw ) for FIR highpass filter is,
H d (e jω ) = 1 ; – π ≤ ω ≤ −ω c and + ω c ≤ ω ≤ + π
= 0 ; otherwise
The desired impulse response hd(n) is obtained by taking inverse Fourier transform of Hd(ejw ).
Chapter 6 - FIR Filters 6. 66
By definition of inverse Fourier transform,
π −ω c π
h d ( n) =
1
2π z
−π
H d (e jω ) e jωn dω =
1
2π z
−π
1 × e jωn dω +
1
2π z
ωc
1 × e jωn dω
=
LM OP
1 e jωn
−ω c
+
LM
1 e jωn OP π
=
LM
1 e − jω c n
−
e − jπn
+
1 e jπn
−
OP
e jω c n LM OP
MN PQ
2 π jn
−π
MN
2 π jn PQ ωc
2π jn MN jn 2 π jn PQjn MN PQ
1 Le OP e jθ − e − jθ
jπn − jπn jω c n − jω c n
=
πn M
M −2 je −
e −e
2j PQ
sinθ =
2j
N
sin πn − sin ω c n
= ; for all n, except n = 0. When n = 0, the hd(n) becomes
πn
0/0, which is indeterminate.
sin πn − sin ω c n
When n = 0 ; h d (0) = Lt
n→0 πn U sin g L' Hospital rule,
=
LM 1 Lt
sin πn
−
1
Lt
sin ω c n ω
=1− c
OP Lt
sin Aθ
=A
Nπ n→0 n π n→0 n π Q θ→ 0 θ
The impulse response of FIR filter is obtained by multiplying hd(n) by window sequence.
= 0 ; otherwise
∴ h(n) = −
sin ω c n LM
0.54 + 0.46 cos
πn OP ; for n ≠ 0 For integer n sin p n = 0.
πn N 3 Q
= 1−
FG IJ LM0.54 + 0.46 cos πn OP ; for n = 0
ωc
H KN π 3 Q
When n = 0
F 0.8π IJ LM0.54 + 0.46 cos π × 0 OP = 0.2
; h(0) = G1 −
H π KN 3 Q
sin b0.8π × 1g L
When n = 1 ; h(1) = −
π×1
MN0.54 + 0.46 cos π 3× 1 OPQ = −0.1441
sin b0.8π × 2 g L
When n = 2 ; h(2) = −
π× 2 MN0.54 + 0.46 cos π ×3 2 OPQ = 0.0469
sin b0.8π × 3g L
When n = 3 ; h(3) = −
π× 3 MN0.54 + 0.46 cos π 3× 3 OPQ = −0.0081
When n = −1 ; h( −1) = h(1) = −0.1441
The transfer function H(z) of the digital FIR highpass filter is given by,
N −1
N −1 N −1 2 3
− −
H ( z) = z 2 l q
Z h(n) = z 2
∑
− N −1
h( n) z – n = z −3 ∑ h( n) z – n
n = −3
n=
2
LM
∴ H(z) = z −3 h(3) z 3 + z −3 + h(2) z 2 + z −2 + h(1) z + z −1 + h(0) OP
N Q
= h(3) z 0 + z −6 + h(2) z −1 + z −5 + h(1) z −2 + z −4 + h(0) z −3
It is observed that the transfer function obtained in both the methods are same.
e j
Frequency response, H e jω = H ( z)
z = e jω
e j
∴ H e jω = −0.0081 1 + z −6 + 0.0469 z −1 + z −5 + −0.1441 z −2 + z −4 + 0.2 z −3
z = e jω
− 01441
. cos 2ω − j sin 2ω + cos 4ω − j sin 4ω + 0.2 cos 3ω − j sin 3ω
Using the above equation the frequency response H(ejw ) and magnitude function |H(ejw )| are calculated for various values of w and listed in
table 2. It is observed that the magnitude response obtained by both the methods are same.
Example 6.7
Design a linear phase FIR bandpass filter to pass frequencies in the range 0.4p to 0.65p rad/sample by
taking 7 samples of hanning window sequence.
Solution
Let us choose symmetric impulse response with symmetry condition h(N 1 n) = h(n). Therefore, the
desired ideal frequency response Hd(ejw ) for bandpass filter is,
hd (n) =
1
2π z
−π
Hd (e jω ) e jωn dω
− ω c1 ω c2
=
1
2π z
− ω c2
e− jωα e jωn dω +
1
2π z
ω c1
e − jωα e jωn dω
− ω c1 ω c2
=
1
2π z
− ω c2
e jω (n − α ) dω +
1
2π z
ω c1
e jω (n − α ) dω
=
LM e
1 OP + 1 LM e
jω (n − α )
− ω c1
OP jω (n − α )
ω c2
MN j(n − α) PQ
2π 2π MN j(n − α ) PQ
−ω c2 ω c1
1 Le − jω c1(n − α )
e OP + 1 LM e
− jω c 2 (n − α ) jω c 2 (n − α )
e jω c1(n − α ) OP e jθ − e− jθ
= M
2π MN j(n − α )
−
j(n − α ) PQ 2π MN j(n − α)
−
j(n − α ) PQ sinθ =
2j
=
1 LM e jω c 2 (n − α )
− e − jω c2 (n − α )
−
e jω c1(n − α ) − e− jω c1(n − α ) OP
π(n − α ) MN 2j 2j PQ When n = a, the hd(n)
sin ω c2 (n − α ) − sin ω c1(n − α ) becomes 0/0 which
= ; for all n except n = α.
π(n − α ) is indeterminate.
Fω −
=G c2 ω c1 IJ 0.5 − 0.5 cos c h 2πn
; for n = α
H π K N− 1
Since, h(n) satisfies the symmetry condition, h(N 1 n) = h(n), calculate h(n) for n = 0 to 3.
=
FG ω c2 − ω c1 IJ FG 0.5 − 0.5 cos nπ IJ ; for n = 3
H π KH 3K
c h c
sin 0.65π (0 − 3) − sin 0.4π (0 − 3) h LMN0.5 − 0.5 cos 0 3× π OPQ
When n = 0 ; h(0) = =0
π(0 − 3)
c h c
sin 0.65π (1 − 3) − sin 0.4π (1 − 3) h LMN0.5 − 0.5 cos 1 ×3 π OPQ
When n = 1 ; h(1) = = −0.0556
π(1 − 3)
c h c
sin 0.65π (2 − 3) − sin 0.4π (2 − 3) h LMN0.5 − 0.5 cos 2 ×3 π OPQ
When n = 2 ; h(2) = = −0.0143
π(2 − 3)
When n = 3 ; h(3) =
FG 0.65π − 0.4π IJ FG 0.5 − 0.5 cos 3π IJ = 0.25
H π KH 3K
N−1 6
l q ∑ h(n) z = ∑ h(n) z
H(z) = Z h(n) = −n −n
n=0 n=0
Structure
Y(z)
Let , H(z) = = −0.0556 z 1 + z 5 − 0.0143 z−2 + z−4 + 0.25 z−3
X(z)
∴ Y(z) = −0.0556 z 1 X(z) + z 5 X(z) − 0.0143 z−2 X(z) + z−4 X(z) + 0.25 z 3 X(z)
The above equation can be used to draw the FIR filter structure as shown in fig 1.
Chapter 6 - FIR Filters 6. 70
−1
z X(z)
+ +
−1
z
+ +
F ig 1 : L in ea r ph a se stru c tu re fo r F IR b a ndp a ss filte r.
Frequency Response
When impulse response is symmetric and N is odd with centre of symmetry at (N 1)/2 the magnitude
response |H(ejw )| is given by |A(w)|,
N−1
2
Refer table 6.2
where, A(ω ) = h e j ∑ 2h e
N−1
2
+
n=1
N−1
2 j
− n cos ωn
case (i)
3
∴ A(ω ) = h(3) + ∑ 2h b3 − ng cos ωn
n=1
|H (e jω)|
0.4
0.35
0.3
0.25
0.2
0.15
0.1
0.05
ω
0 π 2π 3π 4π 5π 6π 7π 8π 9π 10 π 11π 12π 13π 14 π 15 π 16π
16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16
(π/2) (π)
F ig 2 : M a gn itu d e resp o n se o f F IR b a n d p ass filter.
e j
H d e jω = 1 ; − ω c2 ≤ ω ≤ −ω c1 & + ω c1 ≤ ω ≤ ω c2
= 0 ; otherwise
The desired impulse response hd(n) is obtained by taking inverse Fourier transform of Hd(ejw ).
By definition of inverse Fourier transform,
π c1 −ω ω
1 c2
h d ( n) =
1
2π − πz e j
H d e jω e jωn dω =
1
2π −ω
1 × e jωn dω + z
2π + ω
c2
1 × e jωn dω z c1
=
LM OP + 1 LM e OP
1 e jωn
− ωc1
jωn
ωc 2
=
LM
1 e − jωc1n e − jωc 2n
− +
OP
1 e jωc 2n e jωc1n
−
LM OP
MN PQ 2π MN jn PQ
2 π jn
− ωc 2 ωc1
2π MN
jn jn 2π jn PQjn MN PQ
1 Le jω c 2 n − jω c2 n jωc1n
− e − jωc1n OP e jθ − e − jθ
= M −2 je − e
πn MN 2j PQ sinθ =
2j
=0 ; otherwise
\ Impulse response, h(n) = hd(n) ´ wC(n)
=
FG sin ω − sin ω IJ e0.5 + 0.5cos j ; for n ≠ 0
c2 c1 2 πn
H πn K N −1
F ω − ω IJ e0.5 + 0.5cos j
=G c2 c1
; for n = 0 2 πn
H π K N −1
∴ h(n) =
FG sin ω n − sin ω n IJ FG 0.5 + 0.5cos πn IJ ; for n ≠ 0
c2 c1
H πn KH 3K
=G
F ω − ω IJ FG 0.5 + 0.5cos πn IJ ; for n = 0
c2 c1
H π KH 3K
When n = 0 ; h(0) = M
L 0.65π − 0.4π OP LM0.5 + 0.5 cos π × 0 OP = 0.25
N π QN 3 Q
When n = 1 ; h(1) = M
L sin c0.65π × 1h − sin c0.4π × 1h OP L0.5 + 0.5 cos π × 1 O = −0.0143
MN π ×1 PQ MN 3 Q
P
When n = 2 ; h(2) = M
L sin c0.65π × 2h − sin c0.4π × 2h OP L0.5 + 0.5 cos π × 2 O = −0.0556
MN π×2 PQ MN 3 Q
P
When n = 3 ; h(3) = M
L sin c0.65π × 3h − sin c0.4π × 3h OP L0.5 + 0.5 cos π × 3 O = 0
MN π×3 PQ MN 3 PQ
When n = –1 ; h(–1) = h(1) = –0.0143 Using symmetry
condtion,
When n = –2 ; h(–2) = h(2) = –0.0556
h(–n) = h(n).
When n = –3 ; h(–3) = h(3) = 0
The transfer function H(z) of FIR bandpass filter is,
N −1
+
N −1 N −1 2 3
− −
H ( z) = z 2 l q
Z h( n) = z 2
N 1
∑ −h( n) z − n = z −3 ∑ h( n) z − n
n=− n = −3
2
Using symmetry
= z −3 h( −3) z 3 + h( −2) z 2 + h( −1) z + h(0) z 0 + h(1) z −1 + h(2) z −2 + h(3) z −3 condtion,
h(–n) = h(n).
= z −3 h(3) z 3 + h(2) z 2 + h(1) z + h(0) + h(1) z −1 + h(2) z −2 + h(3) z −3
LM
= z −3 h(3) z 3 + z −3 + h(2) z 2 + z −2 + h(1) z + z −1 + h(0) OP
N Q
= h(3) z 0 + z −6 + h( 2) z −1 + z −5 + h(1) z −2 + z −4 + h( 0) z −3
e j
Frequency response, H e jω = H ( z)
z = e jω
e j
∴ H e jω = −0.0556 z −1 + z −5 − 0.0143 z −2 + z −4 + 0.25 z −3
z = e jω
e j e j
= −0.0556 e − jω − e − j5ω − 0.0143 e − j2ω − e − j4ω + 0.25 e − j3ω
Using the above equation the frequency response H(ejw ) and magnitude function |H(ejw )| are calculated for various values of w and listed in
table 2. It is observed that the magnitude response obtained in both the methods are same.
6. 73 Digital Signal Processing
Example 6.8
Design a linear phase FIR bandstop filter to reject frequencies in the range 0.4p to 0.65p rad/sample
using rectangular window, by taking 7 samples of window sequence.
Solution
Let us choose symmetric impulse response with symmetry condition, h(N 1 n) = h(n). Therefore, the
desired ideal frequency response Hd(ejw ) for bandstop filter is,
Hd (e jω ) = e − jωα ; π ≤ ω ≤ ω c2 and ω c1 ≤ ω ≤ + ω c1 and + ω c2 ≤ ω ≤ + π
=0 ; otherwise
The desired impulse response hd(n) obtained by taking inverse Fourier transform of Hd(ejw ).
By definition of inverse Fourier transform,
+π
hd (n) =
1
2π z
−π
Hd (e jω ) e jωn dω
− ω c2 ω c1 π
=
1
2π z
−π
e− jωα ejωn dω +
1
2π z
− ω c1
e− jωα e jωn dω +
1
2π
ω c2
z e− jωα ejωn dω
− ω c2 ω c1 π
=
1
2π z
−π
e jω (n − α ) dω +
1
2π z
− ω c1
e jω (n − α ) dω +
1
2π
ω c2
z ejω (n − α ) dω
=
LM
1 e jω (n − α ) OP OP + 1 LM e
− ω c2
+
LM OP
1 e jω (n − α )
ω c1
jω (n − α )
π
MN
2π j(n − α ) PQ −πPQ 2π MN j(n − α MN
) PQ
2π j(n − α ) − ω c1 ω c2
1 Le e OP + 1 LM e
− jω c 2 (n − α ) − jπ (n − α )
e OP + 1 LM e jω c1(n − α )
e OP − jω c1(n − α ) jπ (n − α ) jω c2 (n − α )
= M
2π MN j(n − α )
−
j(n − α ) PQ 2π MN j(n − α )
−
j(n − α ) PQ 2π MN j(n − α )
−
j(n − α ) PQ
=
1 LM e −e jω c1(n − α )
+
e −e − jω c1(n − α )
−
e −e OP
jπ(n − α ) − jπ (n − α ) jω c2 (n − α ) − jω c2 (n − α )
π(n − α ) MN 2j 2j 2j PQ
sinω c1(n − α ) + sin π(n − α ) − sin ω c2(n − α)
= ; for all n, except n = α e jθ − e− jθ
π(n − α ) sinθ =
2j
Chapter 6 - FIR Filters 6. 74
=
1 LM Lt
sin ω c1(n − α )
+ Lt
sin π(n − α )
− Lt
sin ω c2 (n − α ) OP
π N
(n − α ) → 0 (n − α ) (n − α ) → 0 (n − α ) (n − α ) → 0 (n − α ) Q
1
= ω c1 + π − ω c2 U sin g L' Hospital rule
π
sin Aθ
= 1−
FG ω c2 − ω c1 IJ Lt
θ→ 0 θ
= A
H π K
The impulse response h(n) of FIR filter is obtained by multiplying hd(n) by window sequence.
The window sequence for rectangular window wR(n) is given by,
wR (n) = 1 ; for n = 0 to N − 1
= 0 ; otherwise
N−1 7 −1
∴ α= = = 3 ; N − 1= 6
2 2
Hence calculate h(n) for n = 0 to 6.
Since, h(n) satisfies the symmetry condition, h(N 1 n) = h(n), calculate h(n) for n = 0 to 3.
∴ h(n) =
b g b
sinω c1 n − 3 − sinω c2 n − 3 g ; for n ≠ 3
π n−3 b g Since n and a are
ω − ω c1 integers, sin(n a)p = 0.
= 1 − c2 ; for n = 3
π
sin(0.4π (0 − 3)) − sin(0.65π (0 − 3))
When n = 0 ; h(0) = = −0.0458
π × (0 − 3)
sin(0.4π (1 − 3)) − sin(0.65π (1 − 3))
When n = 1 ; h(1) = = 0.2223
π × (1 − 3)
sin(0.4π (2 − 3)) − sin(0.65π (2 − 3))
When n = 2 ; h(2) = = 0.0191
π × (2 − 3)
When n = 3 ; h(3) = 1 −
FG 0.65π − 0.4π IJ = 0.75
H π K
When n = 4 ; h(4) = h(6 − 4) = h(2) = 0.0191
Using symmetry condition
When n = 5 ; h(5) = h(6 − 5) = h(1) = 0.2223 h(N 1 n) = h(n) Þ h(6 n) = h(n).
When n = 6 ; h(6) = h(6 − 6) = h(0) = −0.0458
The transfer function H(z) of FIR bandstop filter is given by,
N 1 6
l q ∑ h(n) z
H(z) = Z h(n) = n
= ∑ h(n) z n
n = 0 n = 0
6. 75 Digital Signal Processing
∴ H(z) = h(0) + h(1) z −1 + h(2) z−2 + h(3) z −3 + h(4) z−4 + h(5) z −5 + h(6) z −6 Using symmetry
= h(0) + h(1) z −1
+ h(2) z −2
+ h(3) z −3
+ h(2) z −4
+ h(1) z −5
+ h(0) z −6 condition,
h(N 1 n) = h(n).
= h(0) 1+ z−6 + h(1) z−1 + z −5 + h(2) z−2 + z−4 + h(3) z −3
Structure
Y(z)
Let , H(z) = = −0.0458 1+ z−6 + 0.2223 z −1 + z−5 + 0.0191 z−2 + z−4 + 0.75 z−3
X(z)
The above equation can be used to draw the FIR filter structure as shown in fig 1.
−1 −2 −3
z X(z) z X(z) z X(z)
−1 −1 −1
z z z
+ + +
−1 −1 −1
−6 z −5
z −4
z
z X(z) z X(z) z X(z)
−6 −1 −5 −2 −4 −3
−0.0458 [X(z) + z X(z)] 0.2223 [z X(z) + z X(z)] 0.0191 [z X(z) + z X(z)] 0.75z X(z)
+ + +
F ig 1 : L in ea r ph a se stru c tu re fo r F IR b a nd sto p filter.
Frequency Response
When impulse response is symmetric and N is odd with centre of symmetry at (N 1)/2 the magnitude
response |H(ejw )| is given by |A(w)|,
N−1
N−1
2
N−1 Refer table 6.2
where, A(ω ) = h e j + ∑ 2h e
2
n=1
2 j
− n cos ωn case (i)
3
∴ A(ω ) = h(3) + ∑ 2h b3 − ng cos ωn
n=1
Using the above equation the magnitude response, A(w) and magnitude function |H(ejw )| are calculated for
various values of w and listed in table 1. Using these values the magnitude response is plotted as shown in fig 2.
Chapter 6 - FIR Filters 6. 76
w ) and |H(ejww )| for various values of w .
Table 1: A(w
w A(w
w) |H(ejww )| = |A(w
w )| w A(w
w) |H(ejww )| = |A(w
w )|
0 ×π 9×π
16
1.1414 1.1414 16
0.2810 0.2810
1×π 10 × π
16
1.1223 1.1223 16
0.3365 0.3365
2×π 11×π
16
1.0646 0.0646 16
0.4689 0.4689
3×π 12×π
16
0.9697 0.9697 16
0.6583 0.6583
4 ×π 13×π
16
0.8416 0.8416 16
0.8705 0.8705
5×π 14 ×π
16
0.6907 0.6907 16
1.0640 1.0640
6 ×π 15×π
16
0.5346 0.5346 16
1.1992 1.1992
7 ×π 16 ×π
16
0.3974 0.3974 16
1.2478 1.2478
8 ×π
16
0.3054 0.3054
|H (e jω)|
1.2
1.1
1.0
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
ω
π 2π 3π 4π 5π 6π 7π 8π 9π 10 π 11π 12 π 13π 14 π 15π 16π
16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16
( π/2 ) ( π)
F ig 2 : M a gn itu d e resp o n se o f F IR b a n dsto p filter.
= 0 ; otherwise
The desired impulse response hd(n) is obtained by taking inverse Fourier transform of Hd(ejw ).
By definition of inverse Fourier transform,
− ωc2 ωc1
h d ( n) =
1
2π z
π
−π
H d (e jω ) e jωn dω =
1
2π z
−π
1 × e jωn dω +
1
2π z
− ωc1
1 × e jωn dω +
1
2π zπ
ωc2
1 × e jωn dω
6. 77 Digital Signal Processing
∴ h d ( n) =
LM OP + 1 LM e OP + 1 LM e OP
1 e jωn
− ω c2
jωn
ωc1
jωn
π
MN PQ
2 π jn 2 π MN jn PQ
−π
2 π MN jn PQ
− ω c1 ωc 2
1 Le OP + 1 LM e − e OP + 1
− jω c 2 n LM e OP
− jπn jω c1n − jωc1n jπn jω c 2 n
e e
= M
2 π MN jn
−
jn PQ 2 π MN jn jn PQ 2 π MN jn −
jn PQ
M 2 j OPP + LMM e −2 je OPP − LMM e −2 je
1 Le − e OP
jπn − jπn jωc1n − jωc1n jω c 2 n − jω c 2 n e jθ − e − jθ
= sinθ =
πn MN Q N Q N PQ 2j
=
1 1 1
× π + × ω c1 − × ω c2 = 1 −
ω c2 − ω c1 FG IJ Lt
sin Aθ
= A
π π π π H K θ→0 θ
The impulse response h(n) of FIR filter is obtained by multiplying hd(n) by window sequence.
N −1 N −1
Rectangular window sequence, w R ( n) = 1 ; n = − 2
to +
2
= 0 ; otherwise
N −1 7 −1
Here, N = 7, w c1 = 0.4p rad/sample ; w c2 = 0.65p rad/sample ; = =3
2 2
Hence, calculate h(n) for n = –3 to 3.
Since, h(n) satisfies the symmetry condition, h(–n) = h(n), calculate h(n) for n = 0 to 3.
sin ω c1 − sin ω c2 For integer n,
∴ h(n) = ; for n ≠ 0
πn sin pn = 0
=1−
FG ω − ω IJ ; for n = 0
c2 c1
H π K
When n = 0 ; h(0) = 1 − G
F ω − ω IJ = 1 − FG 0.65π − 0.4π IJ = 0.75
c2 c1
H π K H π K
sin b0.4 π × 1g − sin b0.65π × 1g
When n = 1 ; h(1) = = 0.0191
π ×1
When n = 2 ; h(2) =
b g
sin 0.4 π × 2 − sin 0.65π × 2 b g = 0.2223
π×2
When n = 3 ; h(2) =
b g
sin 0.4 π × 3 − sin 0.65π × 3 b g = −0.0457
π×3
When n = −1 ; h( −1) = h(1) = 0.0191 Using symmetry
condtion,
When n = −2 ; h( −2) = h(2) = 0.2223
h(–n) = h(n).
When n = −3 ; h( −3) = h(3) = −0.0457
The transfer function H(z) of the digital FIR bandstop filter is given by,
N −1
N −1 N −1 2 3
− −
H( z) = z 2 l q
Z h(n) = z 2
∑
− N −1
h( n) z – n = z −3 ∑ h( n) z – n
n = −3
n=
2 Using symmetry
condtion,
−3 3 2 0 −1 −2 −3
=z h( −3) z + h( −2) z + h( −1) z + h(0) z + h(1) z + h( 2) z + h(3) z h(–n) = h(n).
Chapter 6 - FIR Filters 6. 78
LM
= z −3 h(3) z 3 + z −3 + h(2) z 2 + z −2 + h(1) z + z −1 + h(0) OP
N Q
= h(3) z 0 + z −6 + h(2) z −1 + z −5 + h(1) z −2 + z −4 + h(0) z −3
It is observed that the transfer function obtained in both the methods are same.
e j
Frequency response, H e jω = H ( z)
z = e jω
e j
∴ H e jω = −0.0457 1 + z −6 + 0.2223 z −1 + z −5 + 0.0191 z −2 + z −4 + 0. 75 z −3
z = e jω
= [ −0.0457 − 0.0457 cos6ω + 0.2223 cos ω + 0.2223 cos5ω + 0.0191 cos2ω + 0.0191 cos 4ω + 0.75 cos3ω ]
+ j[ 0.0457 sin 6ω − 0.2223 sin ω − 0.2223 sin 5ω − 0.0191 sin 2ω − 0.0191sin 4ω − 0.75 sin 3ω ]
Using the above equation the frequency response H(ejw ) and magnitude function |H(ejw )| are calculated for various values of w and listed in
table 2. It is observed that the magnitude response obtained in both the methods are same.
∴ H ( k ) = H d (e jω ) 2 πk ; for k = 0, 1, ..... (N − 1)
ω=
N
3. Compute the N samples of impulse response h(n) using the following equation.
When N is odd,
LM N−1
2
OP
1
Impulse response, h( n) =
N
MMH(0) + 2 ∑ Re H(k) e
k=1
j2 πnk / N
PP .....(6.76)
N Q
When N is even,
LM N
2
−1 OP
1
Impulse response, h( n) =
N
MMH(0) + 2 ∑ Re H(k) e j2 πnk / N
PP .....(6.77)
N k=1
Q Here, H ej
N
2
=0
n=0
∴ H ( k ) = H d (e jω ) 2 π ( 2 k + 1) ; for k = 0, 1, ..... (N − 1)
ω=
2N
Chapter 6 - FIR Filters 6. 80
3. Compute the N samples of impulse response h(n) using the following equation.
When N is odd,
N− 3 Here, H e j=0
N −1
2 2 L jnπ ( 2 K + 1) OP 2
n=0
Example 6.9
Determine the coefficients of a linear-phase FIR filter of length N = 15 which has a symmetric unit sample
response and a frequency response that satisfies the conditions
H e j
2πk
15
=1 ; for k = 0, 1, 2, 3
= 0.4 ; for k = 4
=0 ; for k = 5, 6, 7
Solution
N − 1
For linear phase FIR filter the phase function, q(w) = -aw where α = .
2
15 − 1
Here, N = 15, ∴ α = =7.
2
2πk 2πk
Also, here ω = ω k = = . Hence we can go for type-1 design.
N 15
In this problem the samples of the magnitude response of the ideal (desired) filter are directly given for
various values of k.
2πk
− j7 ×
∴ H(k) = Hd (ω ) ω = ω = 1 e − jαω k =e 15 ; k = 0, 1, 2, 3
k
2πk
− j7 ×
= 0.4 e− jαω k = 0.4 e 15 ; k = 4
=0 ; k = 5, 6, 7
M H(0) + 2 ∑ ReMH(k) e
PQPP
h(n) = N
N M MN
k = 1
MN PQ
1 LM L OPOP
7 j2πnk
= H(0) + 2 ∑ Re MH(k) e 15
15 M MN PQPQ
N k = 1
1 LM L OP LM OPOP
3 j2πnk j2πn × 4
= H(0) + 2 ∑ Re MH(k) e 15 2 Re H(4) e 15
15 M
N MN
k = 1 PQ + MN PQPQ
6. 81 Digital Signal Processing
1 LM 3 L − j7 ×
2πk OP
j2πnk L − j7 × OP OP H(0) = 1
2π × 4 j8 πn
∴ h(n) = 1 + 2 ∑ ReMe 15
× e 15 + 2 Re M0.4 e × e 15 15
15 MN k = 1 MN PQ MN PQ PQ
1 LM 3 L j2πk OP
(n − 7 ) L j8 π OPOP
(n − 7 )
= 1 + 2 ∑ Re Me 15 + 2 Re M0.4 e 15 jθ
e = cos θ + j sin θ
15 MN k = 1 MN PQ MN PQPQ jθ
∴ Re[e ] = cos θ
1 LM1 + 2 cos 2πk (n − 7) + 0.8 cos 8π (n − 7)OP
3
=
15 MN ∑ 15 15 PQ
k = 1
=
1 LM1+ 2 cos 2π (n − 7) + 2cos 4π (n − 7) + 2 cos 6π (n − 7) + 0.8 cos 8π (n − 7) OP
15 N 15 15 15 15 Q
N−1
Here N = 15, \ N 1 = 14, 2
= 7.
When n = 0 ; h(0) =
1 LM
1 + 2 cos
2π(0 − 7)
+ 2cos
4π(0 − 7)
+ 2cos
6π(0 − 7)
+ 0.8 cos
8π(0 − 7) OP
15 N 15 15 15 15 Q
= −0.0141
When n = 1 ; h(1) =
1 LM
1 + 2 cos
2π(1 − 7)
+ 2cos
4π(1 − 7)
+ 2cos
6π(1 − 7)
+ 0.8 cos
8π(1 − 7) OP
15 N 15 15 15 15 Q
= −0.0019
When n = 2 ; h(2) =
1 LM
1 + 2 cos
2π(2 − 7)
+ 2cos
4π(2 − 7)
+ 2cos
6π(2 − 7)
+ 0.8 cos
8π(2 − 7) OP
15 N 15 15 15 15 Q
= 0.04
When n = 3 ; h(3) =
1 LM
1 + 2 cos
2π(3 − 7)
+ 2cos
4π(3 − 7)
+ 2cos
6π(3 − 7)
+ 0.8 cos
8π(3 − 7) OP
15 N 15 15 15 15 Q
= 0.0122
When n = 4 ; h(4) =
1 LM
1 + 2 cos
2π(4 − 7)
+ 2cos
4π(4 − 7)
+ 2cos
6π(4 − 7)
+ 0.8 cos
8π(4 − 7) OP
15 N 15 15 15 15 Q
= −0.0914
When n = 5 ; h(5) =
1 LM
1 + 2 cos
2π(5 − 7)
+ 2cos
4π(5 − 7)
+ 2cos
6π(5 − 7)
+ 0.8 cos
8π(5 − 7) OP
15 N 15 15 15 15 Q
= −0.0181
When n = 6 ; h(6) =
1 LM
1 + 2 cos
2π(6 − 7)
+ 2cos
4π(6 − 7)
+ 2cos
6π(6 − 7)
+ 0.8 cos
8π(6 − 7) OP
15 N 15 15 15 15 Q
= 0.3130
When n = 7 ; h(7) =
1 LM
1 + 2 cos
2π(7 − 7)
+ 2cos
4π(7 − 7)
+ 2cos
6π(7 − 7)
+ 0.8 cos
8π(7 − 7) OP
15 N 15 15 15 15 Q
= 0 . 52
When n = 8, h(8) = h(15 1 8) = h(6) = 0.3130
Using symmetry condition
When n = 9, h(9) = h(15 1 9) = h(5) = 0.0181 h(N 1 n) = h(n)
When n = 10, h(10) = h(15 1 10) = h(4) = 0.0914
Chapter 6 - FIR Filters 6. 82
When n = 11, h(11) = h(15 1 11) = h(3) = 0.0122
When n = 12, h(12) = h(15 1 12) = h(2) = 0.04
When n = 13, h(13) = h(15 1 13) = h(1) = 0.0019
When n = 14, h(14) = h(15 1 14) = h(0) = 0.0141
The transfer function H(z) of the filter is given by Z-transform of h(n)
N − 1 14
∴ H(z) = Z h(n) = l q ∑ h(n) z −n
= ∑ h(n) z−n
n = 0 n = 0
= h(0) + h(1) z −1 + h(2) z−2 + h(3) z−3 + h(4) z −4 + h(5) z−5 + h(6) z−6 + h(7) z−7
+ h(8) z−8 + h(9) z−9 + h(10) z−10 + h(11) z−11 + h(12) z−12 + h(13) z−13 + h(14) z−14
= h(0) + h(1) z −1 + h(2) z−2 + h(3) z−3 + h(4) z −4 + h(5) z−5 + h(6) z−6 + h(7) z−7
+ h(6) z−8 + h(5) z−9 + h(4) z−10 + h(3) z−11 + h(2) z−12 + h(1) z−13 + h(0) z−14
= h(0) 1+ z−14 + h(1) z −1 + z−13 + h(2) z−2 + z−12 + +h(3) z−3 + z−11 Using symmetry
condition
+ h(4) z−4 + z −10 + h(5) z−5 + z−9 + h(6) z−6 + z−8 + h(7)z−7 h(N 1 n) = h(n)
= −0.0141 1+ z −14 − 0.0019 z −1 + z−13 + 0.04 z−2 + z−12 + 0 .0122 z−3 + z−11
Structure
Y(z)
Let , H(z) = = −0.0141 1+ z−14 − 0.0019 z−1 + z−13 + 0.04 z −2 + z −12
X(z)
+ 0.0122 z−3 + z−11 − 0.0914 z−4 + z −10 − 0.0181 z−5 + z−9
∴ Y(z) = −0.0141 X(z) + z −14 X(z) − 0.0019 z −1X(z) + z −13 X(z) + 0.04 z −2X(z) + z −12 X(z)
+ 0.0122 z −3 X(z) + z −11 X(z) − 0.0914 z −4 X(z) + z −10 X(z) − 0.0181 z −5 X(z) + z −9 X(z)
The above equation can be used to draw the FIR filter structure as shown in fig 1.
−1 −2 −3 −4 −5 −6 −7
−1
z X(z) z X(z) z X(z) −1
z X(z) −1
z X(z) −1
z X(z) −1 z X(z)
−1 −1
z z z z z z z
+ + + + + + +
−7
z X(z)
−1 −1 −1 −1 −1 −1 −1
−14
z z −12
z −11
z −10
z −9
z −8
z
−13
z X(z) z X(z) z X(z) z X(z) z X(z) z X(z) z X(z)
−1 −2 −3 −4 −5 −6 −7
−0.0141 × [X(z) −0.0019 × [z X(z) 0.04 × [z X(z) 0.0122 × [z X(z) −0.0914 × [z X(z) −0.0181 × [z X(z) 0.3130 × [z X(z) 0.52z X(z)
−14 −13 −12 −11 −10 −9 −8
+z X(z)] +z X(z)] +z X(z)] +z X(z)] +z X(z)] + z X(z)] + z X(z)]
+ + + + + + +
F ig 1 .
6. 83 Digital Signal Processing
Frequency Response
When impulse response is symmetric and N is odd with centre of symmetry at (N 1)/2 the magnitude
response |H(ejww )| is given by |A(w
w )|,
N−1
2
N−1 N−1
where, A(ω ) = h e j ∑ 2h e
2
+
n=1
2 j
− n cos ωn Refer table 6.2 case (i)
7
∴ A(ω ) = h(7) + ∑ 2h b7 − ng cos ωn
n=1
Using the above equation, the magnitude response A(w) and magnitude function |H(ejw )| are calculated for
various values of w and listed in table 1. Using these values the magnitude response is plotted as shown in fig 2.
1.1
1.0
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0 π 2π 3π 4π 5π 6π 7π 8π 9π 10π 11π 12 π 13 π 14 π 15π 16 π 17 π 18 π 19π 20π 21π 22 π 23π 24 π 25 π 26π 27 π 28π 29 π 30π 31π
16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16
( π)
6. 84
6. 85 Digital Signal Processing
Alternate Method for Frequency Response
e j
Frequency response, H e jω = H ( z)
z = e jω
e j = −0.0141 1 + z
∴He jω −4
− 0.0019 z −1 + z −13 + 0.04 z −2 + z −12 + 0. 0122 z −3 + z −11
= − 0.0141 − 0.0141 cos14ω − j sin 14ω − 0.0019 cos ω − j sin ω + cos13ω − j sin 13ω + 0.04 cos 2ω − j sin 2ω + cos12ω − jsin 12ω
+ 0.0122 cos 3ω − j sin 3ω + cos11ω − j sin 11ω − 0.0914 cos 4ω − j sin 4ω + cos10ω − j sin 10ω
− 0.0181 cos5ω − j sin 5ω + cos 9ω − j sin 9 ω + 0.3130 cos 6ω − j sin 6ω + cos8ω − j sin 8ω + 0.52 cos 7ω − j sin 7ω
= [ − 0.0141− 0.0141cos14ω − 0.0019 cos ω − 0.0019 cos13ω + 0.04 cos2ω + 0.04 cos12ω + 0.0122 cos3ω + 0.0122 cos11ω
− 0.0914 cos4 ω − 0.0914 cos10ω − 0.0181 cos5ω − 0.0181cos 9ω + 0.3130 cos 6ω + 0.3130cos8ω + 0.52 cos 7ω ]
+ j[0.0141 sin14ω + 0.0019 sin ω + 0.0019 sin13ω − 0.04 sin 2ω − 0.04 sin 12ω − 0.0122 sin 3ω − 0.0122 sin11ω
+ 0.0914 sin 4ω + 0.0914 sin10ω + 0.0181sin 5ω + 0.0181 sin 9ω − 0.3130 sin 6ω − 0.3130 sin 8ω − 0.52 sin 7ω ]
Using the above equation the frequency response H(ejw ) and magnitude function |H(ejw )| are calculated for various values of w and listed in
table 2. It is observed that the magnitude response obtained in both the methods are same.
For k = 3 to 8, the samples lie in the range 0.5p < w < 1.5 p
The sampling points on the ideal frequency response are shown in fig 2. The magnitude of samples of H(k)
(Magnitude spectrum) are shown in fig 3.
jω
|H d (e )| |H (k )|
ω k
0 π 2π 3π 4π 5π 6π 7π 8π 9π 10π 0 1 2 3 4 5 6 7 8 9 10
11 11 11 11 11 11 11 11 11 11 F ig 3 : M a g n itu de spe ctru m o f H (k ).
F ig 2 : S a m p lin g p o ints o f H d (e jω).
6. 87 Digital Signal Processing
Based on the above discussions, the equation for DFT coefficients H(k) can be written as shown below.
2πk
− j5×
H(k) = Hd (e jω ) = e− jαω k = e 11 ; for k = 0, 1, 2
ω = ωk
=0 ; for k = 3 to 8
2πk
− j5×
= e− jαω k = e 11 ; for k = 9, 10
LM N − 1
2 LM OPOP
j2πnk
1 Using equation(6.76).
h(n) =
N
MM
H(0) + 2 ∑ ReMH(k) e PPP N
MN k = 1 N QPQ
1 LM L OPOP
5 j2πnk
= H(0) + 2 ∑ ReMH(k) e 11
11 M MN PQPQ
N k = 1
1 LM L OPOP
2 2πk j2πnk
− j5 × H(0) = 1
= 1 + 2 ∑ ReMe e 11 11
11 M MN PQPQ
N k = 1
1 LM L OOP
2 j2πk
(n − 5)
= 1 + 2 ∑ Re Me 11 P
11 M MN PQPQ
N k = 1
=
1 L
M L
1 + 2 ReMe
j2π
11
OP + 2 ReLMe
(n − 5)
j4π
11
OPOP
(n − 5)
11 M
N MN PQ MN PQPQ
1 L 2π(n − 5) 4π(n − 5) O e jθ = cos θ + j sin θ
11 MN 11 PQ
= 1 + 2 cos + 2 cos
11 ∴ Re[e jθ ] = cos θ
N−1
Here, N = 11, \ N 1 = 10, 2
= 5.
Since, h(n) satisfies the symmetry condition h(N 1 n) = h(n) with centre of symmetry at (N 1)/2, calculate
h(n) for n = 0 to to 5.
When n = 0 ; h(0) =
LM
1
1 + 2 cos
2π(0 − 5)
+ 2cos
4π(0 − 5) OP
= 0.0694
11N 11 11 Q
1 L 2π(1 − 5) 4π(1 − 5) O
11 MN 11 PQ
When n = 1 ; h(1) = 1 + 2 cos + 2cos = −0.054
11
1 L 2π(2 − 5) 4π(2 − 5) O
When n = 2 ; h(2) =
11 NM 1 + 2 cos
11
+ 2cos
11 PQ
= −0.1094
1 L 2π(3 − 5) 4π(3 − 5) O
11 MN 11 PQ
When n = 3 ; h(3) = 1 + 2 cos + 2cos = 0.0474
11
1 L 2π(4 − 5) 4π(4 − 5) O
When n = 4 ; h(4) =
11 NM 1 + 2 cos
11
+ 2cos
11 PQ
= 0.3194
1 L 2π(5 − 5) 4π(5 − 5) O
11 MN 11 PQ
When n = 5 ; h(5) = 1 + 2 cos + 2cos = 0.4545
11
Chapter 6 - FIR Filters 6. 88
When n = 6 ; h(6) = h(11 1 6) = h(4) = 0.3194
= h(0) + h(1) z−1 + h(2) z−2 + h(3) z−3 + h(4) z −4 + h(5) z−5
+ h(4) z−6 + h(3) z−7 + h(2) z−8 + h(1) z−9 + h(0) z−10
= h(0) 1+ z−10 + h(1) z−1 + z −9 + h(2) z−2 + z−8 + h(3) z−3 + z−7
= 0.0694 1+ z−10 − 0.054 z−1 + z −9 − 0.1094 z−2 + z−8 + 0.0474 z−3 + z−7
Structure
Y(z)
Let , H(z) = = 0.0694 1+ z−10 − 0.054 z−1 + z −9 − 0.1094 z−2 + z−8
X(z)
+ 0.0474 z−3 + z −7 + 0.3194 z −4 + z−6 + 0.4545 z−5
∴ Y(z) = 0.0694 X(z) + z−10 X(z) − 0.054 z−1X(z) + z−9 X(z) − 0.1094 z −2X(z) + z−8 X(z)
+ 0.0474 z−3 X(z) + z−7 X(z) + 0.3194 z−4 X(z) + z −6 X(z) + 0.4545 z −5 X(z)
The above equation can be used to draw the FIR filter structure as shown in fig 1.
−1 −2 −3 −4 −5
−1
z X(z) z X(z) −1
z X(z) −1
z X(z) z X(z)
−1 −1
z z z z z
+ + + + +
−1 −1 −1 −1 −1
−10
z z −8
z −7
z z
−9 −6
z X(z) z X(z) z X(z) z X(z) z X(z)
−1 −9 −2 −8 −3 −7 −4 −6 −5
0.0694[X(z) + z −10 X(z)] −0.054[z X(z) + z X(z)] −0.1094[z X(z) + z X(z)] 0.0474 [z X(z) + z X(z)] 0.3194 [z X(z) + z X(z)] 0.4545z X(z)
+ + + + +
F ig 1 .
6. 89 Digital Signal Processing
Frequency Response
When impulse response is symmetric and N is odd with centre of symmetry at (N 1)/2 the magnitude
response |H(ejww )| is given by |A(w
w )|,
N−1
2
N−1 N−1
where, A(ω ) = h e j ∑ 2h e
2
+
n =1
2 j
− n cos ωn Refer table 6.2 case (i)
5
∴ A(ω ) = h(5) + ∑ 2h b5 − ng cos ωn
n=1
= h(5) + 2h(4) cos ω + 2h(3) cos 2ω + 2h(2) cos 3ω + 2h(1) cos 4ω + 2h(0) cos 5ω
= 0.4545 + 2 × 0.3194 cos ω + 2 × 0.0474 cos 2ω + 2 × 0.1094 cos 3ω
+ 2 × − 0.054 cos 4ω + 2 × 0.0694 cos 5ω
= 0.4545 + 0.6388 cosω + 0.0948 cos 2ω + 0.2188 cos 3ω − 0.108 cos 4ω
+ 0.1388 cos 5ω
Using the above equation, the magnitude response A(w) and magnitude function |H(ejw )| are calculated for
various values of w and listed in table 1. Using these values the magnitude response is plotted as shown in fig 2.
1.1
1.0
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0 π 2π 3π 4π 5π 6π 7π 8π 9π 10π 11π 12 π 13 π 14 π 15π 16 π 17 π 18 π 19π 20π 21π 22 π 23π 24 π 25 π 26π 27 π 28π 29 π 30π 31π
16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16
( π)
6. 90
6. 91 Digital Signal Processing
Alternate Method for Frequency Response
e j
Frequency response, H e jω = H ( z)
z = e jω
e j = 0.0694 1 + z
∴He jω −10
− 0.054 z −1 + z −9 − 01094
. z −2 + z −8 + 0. 0474 z −3 + z −7
+ 0.3194 z −4 + z −6 + 0.4545 z −5
z = e jω
= 0.0694 + 0.0694 cos10ω − j sin 10ω − 0.054 cos ω − j sin ω + cos 9ω − j sin 9ω
− 01094
. cos 2ω − j sin 2ω + cos8ω − j sin 8ω + 0.0474 cos 3ω − j sin 3ω + cos 7ω − j sin 7 ω
= [ 0.0694 + 0.0694 cos10ω − 0.054 cos ω − 0.054 cos 9ω − 0.1094 cos2ω − 0.1094 cos8ω + 0.0494 cos3ω + 0.0474 cos 7ω
+ 0.3194 cos4 ω + 0.3194 cos 6ω + 0.4545cos5ω]
+ j[ −0.0694 sin10ω + 0.054 sin ω + 0.054 sin 9ω + 01094
. sin 2ω + 0.1094 sin 8ω − 0.0474 sin 3ω − 0.0474 sin 7ω
− 0.3194 sin 4ω − 0.3194 sin 6ω − 0.4545 sin 5ω ]
Using the above equation the frequency response H(ejw ) and magnitude function |H(ejw )| are calculated for various values of w and listed in
table 2. It is observed that the magnitude response obtained in both the methods are same.