UNIT - 7: FIR Filter Design: Dr. Manjunatha. P Professor Dept. of ECE
UNIT - 7: FIR Filter Design: Dr. Manjunatha. P Professor Dept. of ECE
Dr. Manjunatha. P
manjup.jnnce@gmail.com
Professor
Dept. of
ECE
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 2 / 94
Unit 7 Syllabus
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 3 / 94
FIR Filter Design Introduction
1 |ω| ≤ ωc
H(ω) =
0 ωc < |ω| ≤ π
c c
The impulse response is given by 0
Figure 1: Ideal low pass filter
∫ωc , ωc
1 π n= 0
h(n) = H(ω)ejωn dω = sin(ωcn)
2π ωc
π
n ƒ= 0
ωc n
−ω c
Paley-Wiener Theorem:
If h(n) has finite energy and h(n) = 0 for n < 0
then
∫π
| ln |H(ω)||dω < Figure 2: Unit sample response
−π ∞
H(ω) can be zero at some frequencies. but it cannot be zero over any finite of
frequencies, since the integral then becomes infinite.
H(ω) cannot be exactly zero over any band of frequencies. (Except in the trivial
case where h[n]
= 0.) Furthermore, |H(ω)| cannot be flat (constant) over any finite band.
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 5 / 94
FIR Filter Design Introduction
ω −ω14∆f
Passband edge frequency ωs‐‐
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 6 / 94
FIR Filter Design Introduction
Ideal filters are noncausal, hence physically unrealizable for real time signal processing
applications.
Causality implies that the frequency response characteristic H(ω) of the filter cannot be
zero, except at finite set of points in the frequency range. And also H(ω) cannot have an
infinitely sharp cutoff from passband to stopband, that is H(ω) cannot drop from unity to
zero abruptly.
It is not necessary to insist that the magnitude be constant in the entire passband of the
filter. A small amount of ripple in the passband is usually tolerable.
The filter response may not be zero in the stopband, it may have small nonzero value or
ripple.
The transition of the frequency response from passband to stopband defines transition
band.
The passband is usually called bandwidth of the filter.
The width of transition band is ωs − ωp where ωp defines passband edge frequency and ωs
defines stopband edge frequency.
The magnitude of passband ripple is varies between the limits 1 ± δ1 where δ1 is the ripple
in the passband
The ripple in the stopand of the filter is denoted as δ2
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 7 / 94
FIR Filter Design FIR Filter Design
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 8 / 94
FIR Filter Design FIR Filter Design
An FIR system does not have feedback. Hence y (n − k) term is absent in the system. FIR
output is expressed as
ΣM
y (n) = bkx (n −
k) k=0
Linear phase is a property of a filter, where the phase response of the filter is a linear
function of frequency. The result is that all frequency components of the input signal are
shifted in time (usually delayed) by the same constant amount, which is referred to as the
phase delay. And consequently, there is no phase distortion due to the time delay of
frequencies relative to one another.
Linear-phase filters have a symmetric impulse response.
The FIR filter has linear phase if its unit sample response satisfies the following condition:
h(n) = h(M − 1 − n) n = 0, 1, 2, . . . ,
N−1
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 10 / 94
FIR Filter Design Symmetric and Antisymmetric FIR Filters
-2 -1 0 1 2 3 4
-2 -1 0 1 2 3 4
012345 678 n 0 1 2 3 4 5 6 7 8 n
-2 -1 0 1 2 3 4
0 1 2 3 4 5 6 7 8 n 0 1 2 3 4 5 6 7 8 n
Center of Symmetry
Center of Symmetry
-2 -1 0 1 2 3 4
. Σ ,
Σ Σ Σ 01234567 8 n
M − M−1 ,
H(z ) = z +
2 (M−3)/2
h(n) z −n + z −( M −1 −n)
1 2
h n=0 Center of Symmetry
M− 3
. Σ ,
M−1
,
Σ2 Σ Σ
H(e jω
)= h M −1 e −jω 2 +
2 h(n) e −jωn + e −jω(M−1−n)
n=0
− j ωn j ω( M −2 1 ) − j ω( 2 M− 1
− n) M− 1
= e M− 1 e
)
= ej ω( 2 . − j ω( 2
)
e− j ωn e − jω ( M − 1) jωn −jω( M− 1
−jω( ) ejωn − j ω( M −2 1 ) − j ω( 2 − n)
e = M −2 1.e) 2 e = .e
M− 1
= e e e
, , Σ , , , , Σ
e− j ω(M − 1−−n)j ωn −jω(M− 1−n) − j ω M −2 1 jω M− 1
−n − j ω M −2 1 − n
e + = e e 2 +
e , , . e Σ
− j ω M −2 1 M −
= e 2cos −n
1 2
ω
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 12 / 94
FIR Filter Design Symmetric and Antisymmetric FIR Filters
M− 3
M −1 M− 1 Σ2
jω
H(e ) = h( −jω( 2 ) + h(n)[e −jωn + e −jω( M−1−n) ]
2 )e n=0
M− 3
. Σ , ,
Σ , , . Σ
M −1 − j ω M 2− 1
2
− j ω M −2 1 M −
= h e + 2cos 1 2 −n
2 h(n)e
n=0 ω
, , . Σ M− 3
M − Σ2
. M − Σ
− j ω M −2 1 h
= e 1 2 + 2 h(n)cos 1 2 − n
ω n=0
j ∠H(ω)
H(ω) = |H(ω)|e
M− 3
. Σ Σ . Σ
M − 2
M −
|H(ω)| = h + 2 h(n)cos −n
1 2 1 2
ω n=0
. Σ
− M−1
2
for |H(ω)| >
∠H(ω) = . Σ
ω M−1
+ π
0
2
− for |H(ω)| <
Dr. Manjunatha. P (JNNCE) ω UNIT - 7: FIR Filter Design 0 October 25, 2016 13 / 94
FIR Filter Design Symmetric and Antisymmetric FIR Filters
j ∠H(ω)
H(ω) = |H(ω)|e
-2 -1 0 1 2 3 4
2 −1
M
Σ . Σ 0 1 2 3 4 5 6 7 8 n
M −
|H(ω)| = 2 h(n)cos 1 2 −n
ω n=0
Center of Symmetry
.
M−1 Σ
− 2
for |H(ω)| >
∠H(ω) = . Σ
ω M−1
+ π
0
2
− for |H(ω)| <
ω 0
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 14 / 94
FIR Filter Design Design of linear-phase FIR filters using windows
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 15 / 94
FIR Filter Design
Σ∞
Hd (ej ω ) = h (n)e − j ωn
d n=0
2 Obtain the impulse response hd (n) for the desired frequency response Hd (ω) by evaluating
the inverse Fourier transform.
∫ π
1 jω jωn
hd (n) = −π
Hd (e )e
2π
dω
3 In general the sample response hd (n) is infinite in duration and must be truncated at some
point to get an FIR filter of length M. Truncation is achieved by multiplying hd (n) by
window function.
h(n) = hd (n)w (n)
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 16 / 94
FIR Filter Design
H d ( ) H d ( )
1 1
0 p 0 p
Low pass Filter High pass Filter
H d ( ) H d ( )
1 1
0 1 2
0 1 2 3 4
Band pass Filter Band stop pass Filter
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 18 / 94
FIR Filter Design Window Design Techniques
Rectangular window
wR (n)
attenuation.
The width of main lobe is 4π/N Figure 6: Rectangular window
.
1 for n = 0, 1, M − 1
ωR(n) =
0 otherwise
| sin(ωM
|WR(ω)| = )| 2
ω
| sin( 2 )|
n
0 1 2 3 4 5 6 M-1
2|n − M −
2
1
ωT (n) = 1 − |
M −
1
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 20 / 94
FIR Filter Design Window Design Techniques
Hanning window
wH (n)
n
0 1 2 3 4 5 6 M-1
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 21 / 94
FIR Filter Design Window Design Techniques
Hamming window
w H (n)
n
0 1 2 3 4 5 6 M-1
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 22 / 94
FIR Filter Design Window Design Techniques
Blackman window
This is a 2nd -order raised cosine window.
Σ Σ . ΣΣ
. 2πn 4πn
w (n) = 0.42 − 0.5 + 0.08
cos M −1 cos M −1
Σ Σ
W (ω) Σ≈ 0.42WR (ω) + 0.25 W (ω −2π ) + R (ω + 2π
M
)
ΣM
W
+0.04 W R (ω −R4π
M
) + WR (ω 4π
M
)
+
The width of main lobe is: 12π
M
wT (n)
n
0 1 2 3 4 5 6 M-1
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 23 / 94
FIR Filter Design Window Design Techniques
Kaiser window
This is one of the most useful and optimum windows.
, . ,
. Σ2
I0 β 1 − 1 − 2n
M−1
w (n) =
I 0 (β)
Where I 0 (X ) is the modified zero-order Bessel function, and is a parameter that can be chosen
to yield various transition widths and stop band attenuation. This window can provide different
transition widths for the same N.
β = 0 → rectangularwindow β
= 5.44 → Hammingwindow β
= 8.5 → Blackmanwindow
wH (n)
n
012345 6 M-1
Gibbs Phenomenon
The magnitude of the frequency response H(ω) is as shown in Figure. Large oscillations or
ripples occur near the band edge of the filter. The oscillations increase in frequency as M
increases, but they do not dimmish in amplitude.
These large oscillations are due to the result of large sidelobes existing in the frequency
characteristic W (ω) of the rectangular window.
The truncation of the Fourier series is known to introduce ripples in the frequency response
characteristic H(ω) due to the nonuniform convergence of the Fourier series at a
discontinuity.
The oscillatory behavior near the band edge of the filter is called the Gibbs Phenomenon.
To alleviate the presence of large oscillations in both the passband and the stopband
window function is used that contains a taper and decays toward zero gradually .
Design a LPFπusing rectangular window for the desired frequency response of a low pass filter
given by ωc = 2
rad/sec, and take M= 11. Find the values of h(n). Also plot the magnitude
response
.
Solution:
H (e j )
e 1 d
− j ωτ − ω ≤ ω ≤ ω
jω c c
Hd (e ) = − π ≤ ω ≤ −ωc
0 0
ωc ≤ ω ≤ π
0
M −1
2
τ = = 5 2
2
. Figure 20: Frequency response of LPF
jω e− j ωτ
Hd(e ) = − ωc ≤ ω ≤ ωc
0 Otherwise
By taking inverse Fourier transform
Σ Σωc
∫ 1e jω( n−τ )
1 π
jω jωn hd (n) =
hd (n) = Hd (e )e 2π j(n − τ ) − ω
2π −π c
dω ∫ ωc 1 Σ Σ
1 ejω c( n− τ ) − − j ω c(n−τ )
= e− j ω τ ejωn =
2jπ(n −
2π dω Σ e Σ
−ω c
∫ ωc τ) jω c (n−τ ) − − j ωc ( n−τ )
1 1
= ejω( n−τ )
=
2π e
π(n − e2j
−ω c dω
τ)
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 27 / 94
FIR Filter Design Low Pass FIR Filter Design
sin [ωc (n −
hd(n) =
τ )]π(n − sin π (2− 5)
hd(2) = 2
= −0.106
τ) π(2 − 5)
for n ƒ= 5 and ωc = π2 , τ = M 2− 1 = π (3− 5)
5 sin 2
Σ Σ hd (3) = = 0
π (n− 5) π(3 − 5)
sin [ωc (n − sin 2
hd(n) = = = sin π(4−5) = .318
5)] π(n − 5) π(n − hd (4)
2
5) π(4 − 5)
0
for n=5 hd (n) = 0 . Using L Hospital’s Rule hd (5) = sin π(5−5)
2 = .5
π(5 − 5)
sin Bθ
lim = sin π(6−5)
θ→ 0 B hd (6) = 2 = .318
θ π(6 − 5)
π
sin (n
2
− 5) π/2 = sin π(7−5)
2 = 0.0
lim = = 0.5 hd (7)
n→5 π(n − 5) π π(7 − 5)
sin π (0−
5)
2
hd(0) = = 0.0637 sin π(9−5)
2 = 0
π(0 − 5) hd (9) =
π(9 − 5)
sin π (1−
2
5)
hd(1) = = 0 hd (10) = sin π(10−5)
2 = .063
π(1 − 5)
π(10 − 5)
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 28 / 94
FIR Filter Design Low Pass FIR Filter Design
The given window is rectangular window
.
1 for 0 ≤ n ≤ 10
ω(n) =
0 Otherwise
This is rectangular window of length M=11. h(n) = hd (n)ω(n) = hd (n) for 0 ≤ n ≤ 10
Σ− 1
M Σ10
H (z ) = h(n)z− n = −n
jω
|H(e )| = 0.5 + 0.127cos 5ω − 0.212cos 3ω + 0.636cos
ω
|H(e jω )|dB = 20log |H(e jω )| 10
dB
−20
0.2π 0.9535 -0.41
|H(ejw)|
0.3π 1.0758 0.63 −30
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 30 / 94
FIR Filter Design
∫ π
1 jω jωn
hd (n) = H (e )e
2π − π d H (e j )
∫ ωc dω 1 d
1
= e− j ω τ ejωn
2π
∫ ωc dω
−ω c
=
1
ejω( n−τ ) 3 3
2π 0
4 4
Σ−ω c dω Σωc
1 e jω( n−τ )
=
2π j(n − τ ) −ω
Σ
c
Σ sinωc (n −
jω c(n− τ ) − − j ω c( n−τ ) hd(n) =
1 τ )π(n −
=
π(n e− e τ)
τ) 2j
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 31 / 94
FIR Filter Design Low Pass FIR Filter Design
. Σ
3π (0− 3)
sin 4
hd (0) = = 0.075
π(0 − 3)
. Σ
3π (1− 3)
sin 4
hd (1) = = −0.159
π(1 − 3)
M−1 . Σ
n ƒ= 3 ω
c = 3π τ = = 3π (2− 3)
4 2 sin
3 4
= 0.225
Σ Σ hd (2) =
3π (n− 3) π(2 − 3)
sin 4 . Σ
hd(n) = 3π (3− 3)
sin
π(n − 3) 4
hd (3) = = 0.75
π(3 − 3)
0
. Σ
for n=3 hd (n) = 0. Using L Hospital’s Rule sin
3π (4− 3)
4
Σ hd (4) = = 0.225
sin Σ3π (n π(4 − 3)
lim 4 − 3) = 3π/4 = . Σ
n→ 3 π(n − 3) 0.75 sin 3π (5−
4
3)
π hd (5) = = −0.159
π(5 − 3)
. Σ
sin 3π (6−
3)
4
hd (6) = = 0.075
π(6 − 3)
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 32 / 94
FIR Filter Design Low Pass FIR Filter Design
. Σ
2πn
w (n) = 0.54 − 0.46cos
M − To calculate the value of h(n)
. 1Σ
0.54 − 0.46cos 0
ω(0) = = 0.08 h(n) = hd (n)w (n)
6 Σ
.
2π
ω(1) = = .31
0.54 − 0.46cos 6
Σ h(0) = hd (0)w (0) = 0.075 × 0.08 =
ω(2) = . 4π = .77 h(1) = 0.006
6 hd (1)w (1) = −0.159 × 0.31 =
0.54 − 0.46cos Σ h(2) = −0.049
h d (2)w (2) = 0.225 × 0.77 = 0.173
. 6π
ω(3) = = 1 h(3) =
0.54 − 0.46cos 6 hd (3)w (3) = 0.750 × 1 = 0.750
Σ h(4) =
ω(4) = . 8π hd (4)w (4) = 0.225 × 0.77 = 0.173
0.54 − 0.46cos = 0.77
Σ
h(5) = hd (5)w (5) = −0.159 × 0.31 = −0.049
6
. 10π h(6)
ω(5) = = .31 = hd (6)w (6) = 0.075 × 0.08 = 0.006
0.54 − 0.46cos 6
Σ
ω(6) = . 12π
= .08
0.54 − 0.46cos 6
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 33 / 94
FIR Filter Design Low Pass FIR Filter Design
The frequency response is symmetric with M=odd=7
M− 3
Σ2 . Σ
. M −
jω
|H(e )| = h M−1 + 2 h(n)cos −n
1 2
Σ ω n=0
2
Σ2
= h(3) + 2 h(n)cos ω(3 − n) = h(3) + 2h(0)cos 3ω + 2h(1)cos 2ω + 2h(2)cos
ω
= 0.75 + 0.012cos
n=0 3ω − 0.098cos 2ω + 0.346cos
ω
|H(e jω )|dB = 20log |H(e jω )| 2
dB
−4
0.2π 0.9959 -0.0354
|H(ejw)|
0.3π 1.9722 -0.2445 −6
Matlab code
c l c ; cl ea r a l l ; close a l l ;
M= inpu t(’e nte r t h e v a l u e o f M:’);
omega= inpu t(’e nt er t h e v a l u e o f omega:’);
ta u= (M -1)/2 ;
f o r n=0:M-1;
c(n+1)=.5-.5*cos((2*pi*n)/(M-1));
c ( n + 1 ) = . 5 4 - .4 6 * c o s ( ( 2 * p i * n ) / ( M - 1 ) ) ;
i f n==tau
h(n+ 1)= om e ga/pi ;
else
h(n+1)=sin(ome ga *( n- ta u) ) /(pi*( n- ta u ) ) ;
end
end
h
c
fo
r
n=
1:
M
y=h(n)*c(n)
’end
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 35 / 94
FIR Filter Design Low Pass FIR Filter Design
c l c ; cl ea r a l l ; close a l l ;
r a n ge = 0 ;
M= inpu t(’e nte r t h e v a l u e
o f M:’);
f o r omega=0:.1*pi:pi
ran ge= ra nge + 1;
H_omega= abs(0.75+. 0
12*cos(3*omega)-.098
*cos(2*omega)
+. 346*cos(omega));
H_omega=abs(0.25+ . 45*cos(omega)+ . 318*cos(2*omega));
H_indB(range)=20*log10(H_omega)
end
omega= 0:. 1*pi: p i
; i=1:range;
plot(omega,
H_indB(i),’linewi
dth’,2 )
xlabel(’\omega, 0 t o \ p i i n radians’,’fontsize’,13)
ylabel(’ |H(e^{jw})|_{dB}’,’fontsize’,13)
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 36 / 94
FIR Filter Design Low Pass FIR Filter Design
Determine the filter coefficients hd (n) for the desired frequency response of a low pass filter
given by .
jω e− 2j ω for − 4π ≤ ω π4
Hd (e ) = ≤
0 for π4 ≤ |ω| ≤
−π
If we define the new filter coefficients by hd (n) = hd (n)ω(n) where
.
1 for 0 ≤ n ≤ 4
ω(n) =
0 otherwise
Determine h(n) and also the frequency response H(e j ω ) July-2013, July-2011
Solution:
∫ π H (e j )
1 1 d
hd (n) = Hd (e j ω )ejωn dω
2π −π
∫ π /4
1
= e−j2ω ejωn
2π − π /4 0
dω
4 4
∫ π/4
1
= ej ω(n− 2) d
2π − π /4 ω
Σ Σπ / 4 Σ π Σ
1e j ω(n− 2) 1 π
= hd (n) = ej (n−2)
4
− − j 4(n−2)
2π j(n − 2) 2jπ(n − 2) e
−π/4 Σ π π Σ
1 j 4 (n−2)
− − j 4(n−2)
=
e
π(n − 2) e2j
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 37 / 94
FIR Filter Design Low Pass FIR Filter Design
π n hd (n) n hd (n)
sin (n
4
− 2) π/4
lim = = 0 0.159091 3 0.224989
n→ 2 π(n − 2) 0.25 1 0.224989 4 0.159091
π 2 0.25
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 38 / 94
FIR Filter Design Low Pass FIR Filter Design
The frequency response is symmetric with M=odd=5
M− 3
Σ2 . Σ
. M −
jω
|H(e )| = h M−1 + 2 h(n)cos −n
1 2
Σ ω n=0
2
Σ1
= h(2) + 2 h (2 − n) cos ωn = h(2) + 2h(0)cos 2ω + 2h(1)cos
ω
= 0.25 + 0.318cos
n=0 2ω + 0.45cos
ω
dB
−20
0.2π 0.7123 -2.9464
|H(ejw)|
0.3π 0.4162 -7.6132 −30
Design the symmetric FIR lowpass filter whose desired frequency response is given as
. − j ωτ
Hd (ω) = e for |ω| ≤ ωc
0 Otherwise
The length of the filter should be 7 and ωc = 1 radians/sample. Use rectangular window.
Solution:
Desired frequency response Hd (ω)
H (e j )
Length of the filter M =7 1 d
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 40 / 94
FIR Filter Design Low Pass FIR Filter Design
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 41 / 94
FIR Filter Design Low Pass FIR Filter Design
Design the FIR filter using Hanning window
Solution:For M = 7
2πn
ω(n) = 0.5(1 − cos )
M − 1
2πn
ω(n) = 0.5(1 − cos )
6 To calculate the value of h(n)
ω(0) = 0.0
2π h(0) = hd (0)w (0) = 0.01497 × 0 = 0
ω(1) = 0.5(1 − cos ) = .
6 h(1) = hd (1)w (1) = 0.014472 × 0.25 =
25
4π 0.03618
ω(2) = 0.5(1 − cos ) = . h(2) = hd (2)w (2) = 0.26785 × 0.75 = 0.20089
75 6
6π h(3) = hd (3)w (3) = 0.31831 × 1 = 0.31831
ω(3) =
0.5(1 − cos ) = 1 hd (4)w (4) = 0.26785 × 0.75 = 0.20089
h(4) =
6
h(5) = hd (5)w (5) = 0.14472 × 0.25 = 0.03618
ω(4) = 0.5(1 − cos8π ) = .
75 6 h(6) = hd (6)w (6) = 0.014497 × 0.0 = 0
10π
ω(5) =
0.5(1 − cos ) = .25
6
12π
ω(6) =
0.5(1 − cos ) = 0
6
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 42 / 94
FIR Filter Design Low Pass FIR Filter Design
Solution:
3 dB cut-off at 30 π rad/sec
ωc = 30πrad/sec
Sampling frequency FSF = 100 Hz
Stopband attenuation of 50 dB at 45 π rad/sec
H (e j )
As = 50 dB for ωs = 45πrad/sec 1 d
ω= Ω F
sf
Ω1 30π
ω1 = = = 0.3π
rad/sampleFsf 100 0.3 0.3
0
Ω2 45π
ω2 = = = 0.45π Figure 25: Frequency response of LPF
rad/sampleFsf 100
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 43 / 94
FIR Filter Design Low Pass FIR Filter Design
Type of window is
The stopband attenuation of 50 dB is .
provided by the Hamming window e− j ωτ for − ω c≤ ω ≤ ω c
Hd (ω) = 0 Otherwise
which of -53 dB. Hence Hamming win-
dow is selected for the given specifica-
tions. τ = (M − 1)/2 = 55 − 1/2 =
To determine the order of the filter 27
ωc = 0.3π
The width of the main lobe in Ham- ∫
1 ωc
ming window is 8πM e− j ω τ ejωn
hd (n) = 2π dω
−ω c
k 2π = 1
∫ 0.3π
8π
M = ej ω(n− 27)
M 2π − 0.3π dω
8π Σ Σ0.3π
M = 1 ω(n− 27)
ω2 − ω1 = e
2π j(n − 27)
The order of the filter M is: −0.3π
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 44 / 94
FIR Filter Design Low Pass FIR Filter Design
n h(n) n h(n)
The selected window is Hamming M=27 0 0.0 28 0.2567
1 0.0 29 0.1495
2 -0.0012 30 0.0319
. Σ 3 0.0 31 -0.0445
2πn 4 0.0 32 -0.0588
w (n) = 0.54 − 0.46cos 5 0.0021 33 - 0.0278
M − 6 0.0023 34 0.012
. πn
1 Σ 7 0.0 35 0.0308
= 0.54 − 0.46cos 8 -0.0036 36 0.0220
18 9 -0.0052 37 -0.0
10 -0.0021 38 -0.0157
The value of h(n) 11 0.0048 39 -0.0156
12 0.0098 40 -0.0043
13 0.0069 41 0.0069
h(n) = hd (n)w (n) 14 -0.0043 42 0.0098
15 -0.0156 43 0.0048
16 -0.0157 44 -0.0021
for M = 27 17 0.0 45 -0.0052
18 0.0220 46 -0.0036
sin[0.3π(n − Σ . πn 19 -0.0308 47 0.0
h(n) = 0.54 − ΣΣ 20 -0.0120 48 0.0023
27)]π(n − 27) 18 21 -0.0278 49 0.0021
0.46cos 22 -0.0588 50 0.0
23 -0.0445 51 0.0
for n =ƒ 27 24 0.0319 52 -0.0012
25 0.1495 53 0.0
Σ . πn 26 0.2567 54 0.0
h(n) = 0.3 0.54 − ΣΣ 27 0.3
0.46cos 18
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 45 / 94
FIR Filter Design Low Pass FIR Filter Design
An analog signal contains frequencies upto 10 KHz. The signal is sampled at 50 KHz. Design
an FIR filter having linear phase characteristic and transition band of 5 KHz. The filter should
provide minimum 50 dB attenuation at the end of transition band.
Solution:
3 dB cut-off at 30 π rad/sec
Ωp = 2π × 10 × 103rad/sec
Ωs = 2π × (10 + 5) × 103rad/sec
Sampling frequency FSF = 100 Hz
Stopband attenuation of 50 dB at
H (e j )
45 π rad/sec
A = 50 dB for ω = 45πrad/sec 1 d
s s
ω= Ω
Fsf
Ωp = 2π × 10 × 10 =
3
=
ωp Fsf 50 × 103 0.5 0 0.5
0.4π
2π × (10 + 5) × Figure 26: Frequency response of LPF
= Ωs = =
ωs Fsf 103 50 × 103
0.6π
ωp = 0.4π rad/sample
ωs = 0.6π rad/sample
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 46 / 94
FIR Filter Design Low Pass FIR Filter Design
Type of window is .
The stopband attenuation of 50 dB is e− j ωτ
Hd (ω) = for − ωc ≤ ω ≤ ωc
provided by the Hamming window 0 Otherwise
which of -53 dB. Hence Hamming win-
dow is selected for the given specifica- τ = (M − 1)/2 = 41 − 1/2 =
tions. 20
To determine the order of the filter ωc = ω p + ∆ ω
2 = 0.4π + 0.2π
ωc= 0.5π 2
The width of the main lobe in Ham-
∫
ming window is 8πM 1 ωc
hd (n) = e −jωτ e jωn dω
2π 2π
−ω c
∫ 0.5π
8π 1
k = ej ω(n− 20) d
= 8π 2π − 0.5π ω
M≥ M Σ Σ0.5π
ω(n− 27)
ωs− ω 1
=
M p e
2π j(n − 20) −0.5π
The order of the filter M is:
8π = sin[ωc (n − 20)]
π(n − 20) for n ƒ = 20
M ≥ ≥ 40
0.6π − 0.4π
when n = 20
Assume linear phase FIR filter of odd
length Hence select next odd integer
hd (n) = ωc = 0.5π =
length of 41.
0.5 π
π
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 47 / 94
FIR Filter Design Low Pass FIR Filter Design
n h(n) n h(n)
The selected window is Hamming M=41
0 0.0 21 0.3148
1 -0.00146 22 0.0
. Σ 2 0.0 23 -0.1
2πn
w (n) =0.54 − 3 -0.00247 24 0.0
0.46cos . M −Σ 4 0 25 0.055
1
2πn 5 -0.00451 26 0.0
40 6 0.0 27 -0.0337
= 0.54 − 0.46cos
7 0.0079 28 0.0
The value of h(n) 8 0.0 29 0.0213
9 -0.0136 30 0.0
h(n) = hd (n)w (n) 10 0.0 31 -0.0136
11 0.002135 32 0.0
12 0.0 33 0.0079
for M = 41 n ƒ = 20
13 -0.03375 34 0
Σ . ΣΣ 14 0.0 35 -0.0045
sin[0.5π(n − 20)] 2πn
h(n) = 0.54 − 15 0.05504 36 0.0
π(n − 20) 0.46cos 20 16 0.0 37 0.0024
17 -0.1006 38 0.0
for n = 20 18 0.0 39 -0.0014
Σ . ΣΣ 19 0.3148 40 0.0
2πn 20 0.5
h(n) = 0.5 0.54 −
0.46cos 20
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 48 / 94
FIR Filter Design Low Pass FIR
Filter Design
Design an FIR filter (lowpass) using rectangular window with passband gain of 0 dB, cutoff
frequency of 200 Hz, sampling frequency of 1 kHz. Assume the length of the impulse response
as 7.
Solution:
fFcc== FF200
c 200
= 0.2cycles/sample
Hz,
s 1000 Fs = 1000 Hz, H (e j )
ωc = 2π ∗ fc = 2π × 0.2 = 0.4πrad
1 d
M=7
.
e− j ωτ
Hd (ω) = for − ωc ≤ ω ≤ ωc 0.4 0.4
0 Otherwise 0
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 50 / 94
FIR Filter Design Low Pass FIR Filter Design
Using rectangular window design a lowpass filter with passband gain of unity, cutoff frequency of
1000 Hz, sampling frequency of 5 kHz. The length of the impulse response should be 7.
DEC:2013,DEC:2012
Solution:
Fc = 1000 Hz, Fs = 5000 Hz,
fc = FFcs1000
5000= 0.2cycles/sample
ωc = 2πfc = 2 × π × 0.2 = 0.4πrad
M=7
The filter specifications (ωc and M = 7 ) are similar to the previous example. Hence same filter coefficients are
obtained.
h(0)=-0.062341, h(1)=0.093511, h(2)=0.302609
h(3)=0.4, h(4)=0.302609, h(5)=0.093511, h(6)=-0.062341
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 51 / 94
FIR Filter Design Low Pass FIR
Filter Design
Design a normalized linear phase FIR low pass filter having phase delay of τ = 4 and at least 40
dB attenuation in the stopband. Also obtain the magnitude/frequency response of the filter.
1rad/sample
The length of the filter with given τ is related by
M −1
τ=
2 1 0 1
For τ = 4 M = 9
Desired unit sample response hd (n) is
Figure 28: Frequency response
of LPF
∫ ωc when n ƒ = 4
1
hd (n) = e− j ω τ ejωn
2π − ωc dω
∫1 sin[(n − 4)]
1 hd (n) =
= ej ω(n− 4) d π(n − 4)
2π −1 ω
Σ Σ1 when n = 4
1 e ω(n− 4)
= ∫
2π j(n − 4) −1 1 1 ω
hd (n) = 1 −1
1dω = =
2π π π
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 52 / 94
FIR Filter Design Low Pass FIR Filter Design
for n = 0 to 8
Σ . ΣΣ
h(n) = hd (n)w (n) sin(0 − 4) π0
h(0) = 0.5 − 0.5cos = 0.0000
π(0 − 4) 4
The stopband attenuation required for Σ . ΣΣ
sin(1 − 4) π1
this filter is 40 dB. From the table the h(1) = 0.5 − 0.5cos = 0.0022
Hanning window satisfies this require- π(1 − 4) 4
ment. The Hanning window function Σ . ΣΣ
sin(2 − 4) 2π
given by: h(2) = 0.5 − 0.5cos = 0.0724
π(2 − 4) 4
Σ .
sin(3 − 4) ΣΣ3π
. Σ h(3) = = 0.2286
2πn π(3 − 4) 0.5 −
w (n) = 0.5 − Σ 0.5cos 4
M − sin(4 − 4)
0.5cos
1 h(4) = . 4π = 0.3183
π(4 − 4) ΣΣ4
Σ ΣΣ
for n ƒ = 4 and M = 9 sin(5 − 4) 0.5 − 0.5cos 5π
h(5) = = 0.2286
Σ . πn π(5 − 4)
h(n) = sin(n − 4) 0.5 − ΣΣ
.
ΣΣ
π(n − 4) 0.5cos 4 sin(6 − 4) 0.5 − 0.5cos 4
h(6) = = 0.0724
π(6 − 4) Σ . 6π
for n = 4 sin(7 − 4) 0.5 − 0.5cos
Σ . ΣΣ h(7) = = 0.0022
π4 π(7 − 4) Σ . 4
h(n) = 1 0.5 − = 1 ΣΣ
0.5cos 4 π sin(8 − 4) 0.5 − 0.5cos 7π
h(8) = = 0.0000
π π(8 − 4) Σ .
0.5 − 0.5cos 4
8π
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25,ΣΣ
2016 53 / 94
FIR Filter Design Low Pass FIR Filter Design
The frequency response is symmetric with M=odd=9
M− 3
Σ2 . Σ
. M −
jω
|H(e )| = h M−1 + 2 − n cos ω
1 2
Σ h n=0
2
Σ3
= h(4) + 2 h(n)cos ω (4 −
n)
= h(4) + 2h(0)cos
n=0 4ω + 2h(1)cos 3ω + 2h(2)cos 2ω + 2h(3)cos
ω
= 0.3183 + 0.044cos 3ω + 0.1448cos 2ω + 0.4572cos ω
|H(e jω )|dB = 20log |H(e jω )| 10
dB
−20
0.2π 0.7123 -2.9464
0.3π 0.4162 -7.6132 |H(ejw)| −30
Design a HPF using Hamming window. Given that cutoff frequency the filter coefficients hd (n)
for the desired frequency response of a low pass filter given by ωc = 1rad/sec, and take M = 7 . Also plot the
magnitude response.
Solution: e− j ωτ − π ≤ ω≤
−ω
jω c
Hd (e ) = e − j ω τ ωc ≤ ω ≤ −π
0
− ωc ≤ ω ≤ ωc
M −1
τ = = 3
2
.
e− j ω τ
H d(e )j ω= − π ≤ −ω ≤ ωc
0 Otherwise
H d(e j )
1
∫ π
1 jω jωn
hd (n) = Hd (e )e
2π −π c c
∫ − ωdω ∫ π 0
1 c
jω(n−τ ) jω(n− τ )
= [ dω + d
2π e − π e ω
ωc
Σ Σ− ωc Σ Σπ
1e jω( n−τ ) 1e jω(n−τ )
= +
2π j(n − τ ) − π 2π j(n − τ ) ω
c
Σ Σ
1 − j ω c(n−τ ) − e− j π ( n − τ ) + − jω c(n −τ )
= jπ(n−τ )
e
π(n − e 2j e
τ)
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 55 / 94
FIR Filter Design High Pass FIR Filter Design
Σ Σ ΣΣ
jπ(n−τ ) − −jπ(n−τ ) − e jωc ( n−τ ) − − j ω c(n−τ )
hd (n) = 1 e
π(n − τ ) e 2j e
1 [sinπ(n − τ ) − sinωc (n − τ ]
=
π(n − τ )
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 56 / 94
FIR Filter Design High Pass FIR Filter Design
jω Σ2
|H(e )| = h (3) + 2 h(n)cosω(3 −
n) n=0
h (3) + 2h(0)cos3ω + 2h(1)cos2ω + 2h(2)cosω
=
0.6816 − 0.000238cos3ω − 0.0896cos2ω −
= 0.4214cosω
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 57 / 94
FIR Filter Design Band Pass FIR Filter Design
Design the bandpass linear phase FIR filter having cut off frequencies of ωc1 = 1rad/sample and
ωc2 = 2rad/sample. Obtain the unit sample response through following window.
.
1 for 0 ≤ n ≤ 6
ω(n) =
0 Otherwise
Solution:
H d(e j )
. 1
e− j ωτ ωc1≤ |ω | c≤ ω c2
Hd (ω) = 0 Otherwise
c2 c1 0 c 2
c1
∫ π
1 j ωn
hd (n) = Hd (ω)e
2π −π
Σ∫ dω Σ
− ωc1 ∫ ωc2
1 − j ω τ jωn − j ω τ jωn
= e e dω + e
2π e dω
−ωc 2 ωc1
Σ∫ ∫ Σ
1 − ωc1 ωc2
= ejω(n−τ )
jω(n−τ )
+ e
2π dω
−ω c 2 ωc1
Σ Σ −ω c Σ Σω c
= 1 e jω(n−τ ) 1
+ e jω(n−τ ) 2
2π (n − τ ) −ω c 2 (n − τ ω c1
)
= sinωc2 (n − τ ) − sinωc1 (n − τ )
π(n − for n ƒ = τ
τ)
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 58 / 94
FIR Filter Design Band Pass FIR Filter Design
M− 3
Σ . Σ
.
2
M −
H(ω) = h M−1 + 2 h(n)cos −n
1 2
Σ ω n=0
2
Σ2
H(ω) = h(3) + 2 h(n)cos ω (n − 3)
n=0
Estimate the H(ω) by substituting the required values in the above equation.
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 60 / 94
FIR Filter Design
Solution:
H d(e j )
. 1
e− j ωτ c1 ≤ |ω c| ≤ c2
Hd (ω) = ω
0 ω
Otherwise
c2 c1 0 c 2
c1
∫ π
1 j ωn
hd (n) = Hd (ω)e
2π −π
Σ∫ dω Σ
− ωc1 ∫ ωc2
1 − j ω τ jωn − j ω τ jωn
= e e dω + e
2π e dω
−ωc 2 ωc1
Σ∫ ∫ Σ
1 − ωc1 ωc2
= ejω(n−τ )
jω(n−τ )
+ e
2π dω
−ω c 2 ωc1
Σ Σ −ω c Σ Σω c
= 1 e jω(n−τ ) 1
+ e jω(n−τ ) 2
2π (n − τ ) −ω c 2 (n − τ ω c1
)
= sinωc2 (n − τ ) − sinωc1 (n − τ ) =ƒ
π(n − for n
τ
Dr. Manjunatha. P (JNNCE) τ )- 7: FIR Filter
UNIT Design October 25, 2016 61 / 94
FIR Filter Design Band Pass FIR Filter Design
M −1 11 − 1
τ= = = 5
2
Σ 3π (n− Σ2 Σ Σ
5) π (n− 5)
sin − sin
and ωc = π
rad/sample ωc = 3π
rad/sample 4
π (n− 5)
4
for n ƒ =
2 4 hd (n) = 4
3π−π 5
4
π4
for n = 5 for
Design a BPF using Hanning window with M=7. Given that lower cutoff frequency
ωc1 = 2rad/sec and ωc2 = 3rad/sec. Solution:
e for
−−ω j ωτ
c2 ≤ ω ≤
Hd (e jω
)= e − j ω τ for ωc1 ≤ c1ω−ω
≤ ωc2
0 for − ωc − ωc1ω ≤ ωc1
M −1
τ = = 3
2
∫ π
1 jω jωn c 2 c1 0 c1 c2
hd (n) = Hd (e )e
2π −π
∫ − ωdω ∫ ωc2
1 c1
jω(n −τ )
= [ ejω( n−τ )dω + d
2π −ω c2 e ω
ωc1
Σ Σ− ωc1 Σ Σωc1
1 e jω( n−τ ) 1 e jω( n−τ )
= +
2π j(n − τ ) −ω 2π j(n − τ ) ω
c2 c2
1 [sinωc2(n − τ ) − sinωc1(n − τ
=
]
π(n − τ )
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 63 / 94
FIR Filter Design Band Pass FIR Filter Design
τ= M−
21 = 7−1 = 3 2
ωc1 = 2 rad/sec ωc2 = 3 rad/sec
for n ƒ = 3
hd (n) = 1 [sin3(n − 3) −
sin2(n − 3)]
π(n − 3) n h(n) n h(n)
for n = τ 0 0 4 0
Σ Σ 1 0.0189 5 0.0189
1 sinωc2(n − τ ) sinωc1(n − 2 -0.01834 6 -0.01834
hd (n) = lim − lim
π n→ τ (n − n→ τ (n − τ ) 3 0.3183
τ) τ)
1 hd (n) = [ωc2 − ωc1] = 1
π π
0≤ n≤ M − 1
for 0 ≤ n ≤ 6
This is rectangular window Σ
ofsin3(n
length−M=11. In this −
τ ) Σ− sin2(n case
τ
Σ Σ
h(n) = 2πn
h(n) = hd (n)ω(n) = hd (n)) π(n − 3) 0.5 − 0.5cosM −
1
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 64 / 94
FIR Filter Design Band Pass FIR Filter Design
Σ− 1
M Σ6
H (z ) = h(n)z− n = −n
Σ3
|H(e j ω)| = h (3) + 2h (3 − n)
cosωn n=1
jω Σ3
|H(e )| = h (3) + 2h (3 − n)
cosωn n=1
Σ5
= h(3) + 2h (5 − n)
cosωn
= h(3) + 2h(2)cosω
n=1 + 2h(1)cos2ω + 2h(0)cos3ω
= 0.3183 − 0.3668cosω + 0.0378cos2ω
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 65 / 94
FIR Filter Design Bandstop FIR
Filter Design
Design a bandstop filter to reject the frequencies from 2 to 3 rad/sec using rectangular window
with M=5. Find the frequency response.
Solution:
H (e j )
− j ωτ
d
e for − π ≤ ω ≤ −ω c2 1
− j ωτ
jω for − ω c1 ≤ ω≤ ω
Hd(e ) =
e− j ωτ for ω c2≤ c1ω≤ π
0 for ωc1 ≤ |ω| ≤ ωc2
0
c2
c1 c1 c2
e
∫ π
1 jω jωn
hd (n) = H (e )e
2π − π d
∫ − ωdω ∫ ωc1 ∫ π
1 c2
= [ ejω( n−τ )dω + jω( n−τ )
dω + jω( n−τ )
d
2π − π e −ω c1 e ω
ωc2
Σ Σ− ωc2 Σ Σωc1 Σ Σπ
1 e jω( n−τ ) 1 ejω( n−τ ) 1e
= + jω( n−τ ) +
2π j(n − τ ) − π 2π j(n − τ ) −ω 2π j(n − τ ) ω
c1 c2
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 66 / 94
FIR Filter Design Bandstop FIR Filter Design
ω(n) = 1
This is rectangular window of length M=5.
In this case h(n) = hd (n)ω(n) = hd (n) for 0 ≤ n ≤ 4
0≤ n≤ M − 1
hd (n) = 1 [sin2(n − 2) + sinπ(n − 2) − for n ƒ =
sin3(n − 2)] 2
π(n − 2)
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 67 / 94
FIR Filter Design Bandstop FIR Filter Design
Σ Σ
sin2(0 − 2) + sinπ(0 − 2) − sin3(0 −
n = 0 h(0) = 2) = −0.0759
π(0 − 2)
Σ Σ
sin2(1 − 2) + sinπ(1 − 2) − sin3(1 −
n = 1 h(1) = = 0.2445
2) π(1 − 2)
n = 2 h(2) = 1 [π − 1] =
0.6817
Σπ Σ
sin2(3 − 2) + sinπ(3 − 2) − sin3(3 −
n = 3 h(3) = = 0.2445
2) π(3 − 2)
Σ
sin2(4 − 2) + sinπ(4 − 2) − sin3(4 −
n = 4 h(4) = 2) = −0.0759
π(4 − 2)
Σ
Σ− 1
M Σ4
H (z ) = h(n)z− n = −n
= −0.0759 + 0.2445z −1
+ 0.6817z −2
+ 0.2445z −3
− 0.0759z
−4
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 68 / 94
FIR Filter Design Bandstop FIR Filter Design
Σ2
|H(e j ω)| = h (2) + 2h (2 − n)
cosωn n=1
jω Σ3
|H(e )| = h (3) + 2h (3 − n)
cosωn n=1
h(2) + 2h(1)cosω + 2h(0)cos2ω
=
0.6817 + 2(0.2445)cosω +
= 2h(−0.0759)cos2ω
= 0.6817 + 0.4890cosω − 0.1518cos2ω
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 69 / 94
FIR Filter Design FIR Filter Design Using Kaiser Window
wk (n) =
I0(α)
where M is the order of the filter, I0 (x ) is a zeroth Bessel function of the first kind
Σ∞ Σ 1 . Σ k
I0(x ) = 1 + Σ
x 2
k!
k=1
2
P C S
Passband Transition
Stopband
band
Figure 30: Frequency response of LPF
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 71 / 94
FIR Filter Design FIR Filter Design Using Kaiser Window
Kaiser Window Design Equations
1 Determine ideal frequency response
.
1 for |ω| ≤ c
Hd(e )j ω=
ω
0 for ωc ≤ |ω| ≤ π
where ωc = 1 (ω2 p + ωs )
2 Chose δ such that the actual passband ripple, Ap is equal to or less than the specified passband ripple A˜p ,
and the actual minimum stopband attenuation A is equal or greater than the specified minimum stop
attenuation A˜s
δ = min(δp, δs )
˜
100.05Ap
where δp= − 10.05A ˜
and δs= 10−0.05A
˜ s
10 p +1
3 The actual stopband attenuation is
A = −20log10δ
4 The parameter α is
for A ≤ 21
α = for 21 < A ≤ 50
0.5842(A − 21)0.4 + 0.07886(Aa − 21)
0 for A > 50
0.1102(A −
8.7)
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 72 / 94
FIR Filter Design FIR Filter Design Using Kaiser Window
Σ− 1
M
−n
H(z ) =
h(n)z n=0
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 73 / 94
FIR Filter Design FIR Filter Design Using Kaiser Window
π 4
Design a lowpass filter with a cutoff frequencies from wc = ∆ω = 0.02π and a stopband
ripple δs = 0.01. Use Kaiser window
Solution: .
1 for |ω| ≤
H d(e )j ω= c
ω
0 for ωc ≤ |ω| ≤ π A = −20logδs= −20log (0.01) = 40 dB
The inverse transform of the Hd (e j ω ) is
0.4
∫ π α = 0.5842(A − 21) + 0.07886(A −
1
hd (n) = H (e j ω )ejωn dω 21)
2π − π d 0.5842(40 − 21)0.4 + 0.07886(40 −
∫ ωc = 21)
1
= ej ωn = 3.4
2π
−ω c dω
Σ ω
1 eΣ j ωn c 0.02π
= ∆f = = 0.01
2π jn 2π
−ω c
1 Σ jω cn Σ
= e − − j ω cn A−
2j πn e M ≥ 7.95 ≥ 223.189 c 225
Σ Σ 14.36∆f
1 ejω cn − − j ω cn
= 225 − 1
e
πn 2j τ= = 112
2
= sinωc n
πn
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 74 / 94
FIR Filter Design FIR Filter Design Using Kaiser Window
Σ . Σ
. Σ2
I0 α 1 − 2n
M−1
wk (n) = 0≤ n≤ M −
I0(α) 1
Σ , Σ
. 2n 2
I03.4 1 − Σ224
wk (n) = 0≤ n≤ M −
I0(3.4) 1
Σ , Σ
. 2n 2
I03.4 1 − Σ224
1
h(n) = hd × wk (n) = [sinωc n] × I0(3.4)
πn
where
t ∆ω 0.02π
ωc = ω +
c 2 = 0.25π + = 0.26π
2
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 75 / 94
FIR Filter Design FIR Filter Design
Using Kaiser Window
Find an expression for the impulse response h(n) of a linear phase lowpass FIR filter using Kaiser
window to satisfy the following magnitude response specifications for the equivalent analog filter.
Stopband attenuation: 40 dB
Passband ripple: 0.01 dB
Transition width: 1000 π rad/sec
Ideal cutoff frequency: 2400 π rad/sec
Sampling frequency: 10 KHz
Solution:
A= −20logδs = 40 dB ∆Ω
∆ω = 1000π =
s = 0.1π rad f
logδs = −2 ⇒ δs = 0.01 10 ×
103
∆f = 0.1
20log (1 + δp ) = 0.01 =π 0.05
2π
58.8 − 7.95
δp = 0.00115 M ≥ A − 7.95 ≥ = 70.82 c 71
log (1 + δp ) = 0.0005 14.36∆f 14.36 ×
δmin(δ p,sδ ) = 0.00115 0.05
A = −20log (0.00115) = 58.8 71 − 1
τ =
Dr. dB
Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 76 / 94
FIR Filter Design FIR Filter Design Using Kaiser Window
Σ πn
, Σ
. 2n 2
I05.48 1 − Σ224
1
h(n) = hd × wk (n) = [sinωc (n − τ )] I0(5.5)
π(n − τ )
×
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 77 / 94
FIR Filter Design FIR Filter Design Using Kaiser Window
Find an expression for the impulse response h(n) of a linear phase Design a lowpass FIR filter
satisfying the following specifications using Kaiser window
αp ≤ 0.1 dB αs ≥ 44 dB
ωp = 20 rad/sec ωs= 30 rad/sec ωsf = 100 rad/sec
Solution: .
1 for |ω| ≤ c
H d(e )j ω=
ω
0 for ωc ≤ |ω| ≤ π
∆ω = ωs − ωp = 10rad/sec 1
The inverse transform of the Hd (e j ω ) is
∫ π ωc = (ω
2 p+ ωs ) = 25rad/sec
1 jω jωn
hd (n) = H (e )e 25
2π − π d c
∫ ω c dω 100
π
1
= ω (in discrete
− 0.05As and radian) = 2 (2π) = rad
jωn
2π − ωc e dω = 10 = 6.3096 × − 3
δs = 10 − 0.05× 44
Σ j ωn ωc 10
1 eΣ 0.05×0.1 − 1
= 100.05Ap − 1 = 10 = 5.7563×10−3
2π jn δp =
−ω c 100.05Ap + 1 100.05×0.1 + 1
1 Σ jω cn Σ
= e − − j ω cn δ = min(δp, δs ) = 5.7563 × 10−3
2j πn e
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 78 / 94
FIR Filter Design FIR Filter Design Using Kaiser Window
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 79 / 94
FIR Filter Design FIR Filter Design Using Kaiser Window
Design a high pass digital satisfying the following specifications using Kaiser window
Passband cut-off frequency fp = 3200Hz Stopband cut-off frequency fs = 1600Hz Passband ripple
A = −20log10(δ) = 44.797dB
ωs = 2πfs = 3200π rad/sec
ωsf = P 2πF
Dr. Manjunatha. = 20000π
(JNNCE) rad/sec
UNIT - 7: FIR Filter Design October 25, 2016 80 / 94
FIR Filter Design FIR Filter Design Using Kaiser Window
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 82 / 94
Design of FIR system Frequency Sampling for FIR Filters
In this method a set of M equally spaced
samples in the interval (0, 2π)are taken in
the desired frequency response Hd (ω).
The continuous frequency ω is replaced by
2π
ω = ωk = k k = 0, 1, . . . M
M
−1 | H d ( ) | k
2 k 2 k
M 17
K=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 83 / 94
Design of FIR system Frequency Sampling for FIR Filters
For the FIR filter to be realizable the coefficients h(n) must be real. This is possible if all
complex terms appear in complex conjugate pairs. Consider the term
H ( M − k ) e j2πn(M−k) /M
j2πn( M−k)/M
j2πn −j2πkn/M
H(M − k)e = H(M − k)e e
j 2π n(M − k)/ M
− j 2π kn/ M ∵ e j2πn = cos(2πn) + jsin(2πn) = 1
H(M − k)e = H(M − k)e
H(M − k ) = H ∗ (k)
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 84 / 94
Design of FIR system Frequency Sampling for FIR Filters
where P is . M−1
2 if M is odd
P= M
2− 1
if M is even
Σ− 1
M
− j ωn
H (ω) =
h(n)e n=0
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 85 / 94
Design of FIR system Frequency Sampling for FIR Filters
Design a lowpass FIR filter using frequency sampling technique having cut-off frequency of π/2
rad/sample. The filter should have linear phase and length of 17.
Solution:
The Ideal LPF frequency response Hd (ω)
for the linear phase is
, ,
M− 1
,
2 k 2 k
π | H d () | k
−jω 2 0≤ ω ≤ M 17
Hd (ω) = e π 2 K=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
2
≤ ω≤
0 π
.
e− j 8ω 0 ≤ ω π2 4 8 20
3 30
2
Hd (ω) = 0 ≤ π2 ≤ ω ≤ π 2 17
17 17 2 17
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 86 / 94
Design of FIR system Frequency Sampling for FIR Filters
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 87 / 94
Design of FIR system Frequency Sampling for FIR Filters
Determine the impulse response h(n) of a filter having desired frequency response
, , (M − 1)ω ,
−j π
Hd(w ) = e 2
0 ≤ |ω| ≤ 2
π
0 2
≤ ω≤
π
M = 7 use frequency sampling approach.
Solution:
The Ideal LPF frequency response
Hd (ω) is
, , , | H d () | k
2 k 2 k
− j ω M −2 1 π M 7
Hd(ω) = e 0≤ ω ≤ 2 K=0 1 2 3 4 5 6 7
π
0 2
≤ ω≤
π
. 2
e− j 3ω 0 ≤ ω π2 7
4 6 8 10 3 12 2
Hd (ω) = 0 ≤π2 ≤ ω ≤ π 2 7 7 7 7 2 7
( )
To sample put ω = 2πk
M = 2πk
7 6 (k 7)
, 6 k k 7
2π k k 3k
e− j 7 0≤
2π k
≤
π 7
Hd(ω) = 3
π
7 2
0 2
≤ 2π k
≤
7 π The range of k is
, 6πk
e−j 7 0 ≤ k ≤ 74 7 = π2
2πk k = c
Hd(ω) = 7 4 k = π k1 = 7 c
2π
0 7
4
≤ k ≤ 72 7 2
3
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 88 / 94
Design of FIR system Frequency Sampling for FIR Filters
The value of h(n)is given by
The range of k is 0 ≤ k ≤ 74 M− 1
Σ
1 Σ2 Σ
k is an integer. h(n) = H(0) + 2
Hence the range is 0 ≤ k ≤ 1 M Re H ( k) e j2πkn/M
k=1
Similarly 747 ≤ k ≤ = 1.75 ≤ k ≤ ,
The range22 ≤ k ≤ 3
3.5 1 Σ3 Σ ,
j 2π kn/ 7 Σ
10≤ k ≤ 1 = 1+ 2 Re H(k)e
7 k=1
|H (k)| = 2≤ k≤ 3
0 1 k= 6
|H(k)| = 1 0≤ k ≤ 1
,
1 Σ1 Σ ,
n h(n) n h(n) 6π k Σ
h(n) = 1+ 2 Re e −j 7 e j2πkn/7
0 -0.1146 4 321 7
k=1
1 0.0793 5 0.0793 , ,
1 Σ1 Σ Σ
2 0.321 6 -0.1146 = 1+ 2
3 0.4283 7 Re e j2πk(n−3)/7
k=1
, Σ Σ,
1 Σ1 2πk(n −
= 1+ 2
7 cos k=1 3) 7
Determine the filter coefficients h(n) obtained by frequency sampling Hd (w ) given by
, − j 3ω
e 0 ≤ |ω| ≤ 2π
Hd (w ) = 0 π
≤ ω≤ π
2
Also obtain the frequency response H(w ). Take N=7. DEC 2011
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 89 / 94
Design of FIR system Frequency Sampling for FIR Filters
0 1 12 ≤ k ≤ 14
3 28
4 6 18 2
2 15
15
. 15 15 2
− 14
πk 0≤ k≤ 7
θ(k) = 15 ()
14
14π − 14
15 πk = − 15 π(k − 15) 8 ≤ k ≤ 14
14 (k 15)
14 k k
7 15
k k
15
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 90 / 94
Design of FIR system Frequency Sampling for FIR Filters
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 91 / 94
Design of FIR system Frequency Sampling for FIR Filters
0.4 k = 11 0.4 0.4
1 12 ≤ k ≤ 14
4 6 3 28
18 2
2 15
15 15 2 15
. ()
− 14
πk 0≤ k ≤ 7
θ(k) = 15
− 14
π(k − 15) 8 ≤ k ≤ 14
15 14 (k 15)
14 k k 15
k 7k
15
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 92 / 94
Design of FIR system Frequency Sampling for FIR Filters
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 93 / 94
References
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 94 / 94