FIR Filter Design
UNIT - 7: FIR Filter 2 /
Unit 7: FIR Filter Design:
1
2
3
4
5
PART-B-Unit 7: FIR Filter Design:
Introduction to FIR
Filters Design of FIR
Filters using
Rectangular
window Hamming
UNIT - 7: FIR Filter 3 /
window Hanning
window Bartlet
window Kaiser
window
Design of FIR Filter using frequency sampling technique.
Advantages of the FIR digital filter
Relatively easy to design and computationally more
efficient. FIR filters are implemented in hardware or
software.
The phase response is linear. Linear phase property implies that the phase is a
linear function of the frequency. FIR filter output is delayed by the same amount of
time for all frequencies, thereby eliminating the phase distortion (Group delay).
FIR filters are always stable i.e. for a finite input, the output is always finite.
In linear phase, for the filter of length N the number of operations are of the order of
N/2.
Disadvantages of the FIR digital filter (compared to IIR filters)
They require more memory and/or calculation to achieve a given filter response
characteristic. Also, certain responses are not practical to implement with FIR filters.
For a desired frequency response, with tight constraints on the passband, transition
band and the stopband, a FIR filter may have large number of coefficients, thereby
have more arithmetic operations and hardware components.
An LTI system is causal iff
Input/output relationship: y [n] depends only on current and past input signal
values. Impulse response: h[n] = 0 for n < 0
System function: number of finite zeros ≤ number of finite poles.
∫
∫
1 |ω| ≤
c
FIR Filter Design
H (e j )
d
1
An ideal lowpass filter is given by
H(ω) =
0 ωc < |ω| ≤ π
 c
0
  
The impulse response is given
by Figure 1: Ideal low pass filter
1
h(n) = ωc
H(ω)ejωn
dω =
ωc
π sin(ω n)
n = 0
2π
−ωc
ωc c
π ωc n n /= 0
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
,
FIR Filter Design
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.
2
Magnitude Characteristic of FIR filter
δ1 Passband
‐‐ ripple
δ2 Stopband ripple
‐‐ ωp Passband
‐‐ edge fre
The magnitude response can be expressed as
Magnitude =
1 − δ1 ≤ |H(ω)|1 + δ1 for 0 ≤ ω ≤ ωp
0 ≤ |H(ω)δ2 for ωs ≤ ω ≤ π
Approximate formula for order N is
N =
−10log10(δ1δ2) − 15
14∆f
where ∆f =
ωs −ωp
= fs − fp
Approximate formula for order N is
2π
N = k
ωs − ωp
M
The width of the main lobe
is
N = k 2π
Figure 3: Magnitude Specification of FIR
FIR Filter Design
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.
FIR Filter Design
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
FIR Filter Design FIR Filter
Design
UNIT - 7: FIR Filter 12 /
FIR Filter Design
Σ
Σ
Σ
FIR Filter Design FIR Filter
Design
UNIT - 7: FIR Filter October 25, 13 /
An FIR system does not have feedback. Hence y (n − k) term is absent in the system.
FIR output is expressed as
If there are M coefficients
then
M
y (n) = bk x (n − k)
k=0
M−1
y (n) = bk x (n − k)
k=0
The coefficients are related to unit sample response as
h(n) =
bn for 0 ≤ n ≤ M − 1
0 otherwise
Expanding the summation
y (n) = b0x (n) + b1x (n − 1) + b2x (n − 2) + . . . b(M−1)x (n − M + 1)
Since h(n) = bn then y(n) is
M−1
FIR Filter Design FIR Filter
Design
UNIT - 7: FIR Filter October 25, 14 /
y (n) = h(k)x (n − k)
k=0
UNIT - 7: FIR Filter October 25, 15 /
Symmetric and Antisymmetric FIR Filters Linear Phase FIR
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
The Z transform of the unit sample response is given as
Σ
UNIT - 7: FIR Filter October 25, 16 /
M−1
H(z ) = h(n)z −n
n=0
FIR Filter Design Symmetric and Antisymmetric FIR
Filters
UNIT - 7: FIR Filter October 25, 17 /
0 1 2 3 4 5 6 7 8n
Center of Symmetry
0 1 2 3 4 5 6 7 8n
0 1 2 3 4 5 6 7 8n
Center of Symmetry
Symmetry: h(n)=h(M-1-n) Odd M Symmetry: h(n)=h(M-1-n) Even M
h[n] h[n]
0 1 2 3 4 5 6 7 8 n
Center of Symmetry
Antisymmetry: h(n)=-h(M-1-n) Odd M Antisymmetry: h(n)=-h(M-1-n) Even M
h[n] h[n]
Center of Symmetry
Figure 4: Symmetric and antisymmetric responses
FIR Filter Design Symmetric and Antisymmetric FIR
Filters
UNIT - 7: FIR Filter October 25, 18 /
The unit sample response of FIR filter is symmetric if h(n) = h(M − 1 − n)
The unit sample response of FIR filter is antisymmetric if h(n) = −h(M − 1 − n)
Σ
Σ
2
Σ
2 2 e 2 .e
FIR Filter Design Symmetric and Antisymmetric FIR
Filters
UNIT - 7: FIR Filter October 25, 19 /
2
2
0 1 2 3 4 5 6 7 8n
Center of Symmetry
Frequency response of Linear Phase FIR Filter: Symmetric with M=odd
M−1
H(z ) = h(n)z −n
n=0
Symmetry: h(n)=h(M-1-n) Odd M
h[n]
Symmetric impulse response with M=odd Then
h(n) = h(M − 1 − n) and (z = ejω
)
H(z ) = h
M − 1
,
M−1
(M−3)/2
+
n=0
h(n)
h
z −n
+ z −(M−1−n)
i
H(ejω
) = h
M − 1
−jω
,
M−1
M−3
2
n=0
h(n)
h
e−jωn
+ e−jω(M−1−n)
i
−jωn
−jωn jω(
M−1
) −jω(
M−1
) jω(
M−1
−n) −jω(
M−1
)
e = e e 2
e
2 = e 2 .e 2
e−jω(M−1−n)
= e −jω(M−1)
ejωn
= e
−jω(
M−1
)
.e −jω(
M−1
) jωn −jω(
M−1
) −jω(
M−1
−n)
-2
-1
0
1
2
3
e +
z
2
2
2 e 2 2
,
FIR Filter Design Symmetric and Antisymmetric FIR
Filters
UNIT - 7: FIR Filter October 25, 20 /
−jωn
−jω(M−1−n)
−jω
,
M−1
jω
,
M−1
−n −jω
,
M−1
−n
−jω
M−1
= e
2cosω
M − 1
— n
2
e +
= +
2
Σ
2
2
Σ
2
Σ

2
Σ
∠H(ω) =
 −ω + π for |H(ω)|
< 0
FIR Filter Design Symmetric and Antisymmetric FIR
Filters
21 /
October 25,
UNIT - 7: FIR Filter
H(ejω
) = h( M − 1
2
)e−jω( M−1
)
+
M−3
2
n=0
h(n)[e−jωn
+ e−jω(M−1−n)
]
= h
M − 1
−jω
,
M−1
M−3
2
n=0
h(n)e −jω
,
M−1
2cosω
M − 1
— n
2
= e
−jω
,
M−1
2

h
M − 1
2
M−3
2
+ 2
n=0
h(n)cos ω
M − 1
2
— n


H(ω) = |H(ω)|ej∠H(ω)
|H(ω)| = h
M − 1
+ 2
M−3
2
n=0
h(n)cos ω
M − 1
— n
2

e
+

 −ω for |H(ω)|
> 0
FIR Filter Design Symmetric and Antisymmetric FIR
Filters
22 /
October 25,
UNIT - 7: FIR Filter
M−1
2
M−1
2

2

Σ
2

 −ω for |H(ω)|
> 0
∠H(ω) =
 −ω + π for |H(ω)|
< 0
FIR Filter Design Symmetric and Antisymmetric FIR
Filters
October 25, 23 /
UNIT - 7: FIR Filter
Frequency response of Linear Phase FIR Filter: Symmetric with M=Even
H(ω) = e
−jω
,
M−1
2


2
M
−1
n=0
h(n)cos ω
M − 1
2 — n

 Symmetry: h(n)=h(M-1-n) Even M
h[n]
H(ω) = |H(ω)|ej∠H(ω)
|H(ω)| = 2
M
−1
n=0
h(n)cos ω
M − 1
— n
2
0 1 2 3 4 5 6 7 8 n
Center of Symmetry
M−1
2
M−1
2
-2
-1
0
1
2
3
Σ
FIR Filter Design Design of linear-phase FIR filters using
windows
24 /
October 25,
UNIT - 7: FIR Filter
Design of linear-phase FIR filters using
windows
Σ
∫
FIR Filter
Design
UNIT - 7: FIR Filter 25 /
October 25,
1
2
3
Design steps for Linear Phase FIR Filter (Fourier Series method)
Based on the desired frequency response specification Hd (ejω
) determine the
corresponding unit sample response hd (n).
∞
Hd (ejω
) = hd (n)e−jωn
n=0
Obtain the impulse response hd (n) for the desired frequency response Hd (ω) by
evaluating the inverse Fourier transform.
1 π
hd (n) =
−π Hd (ejω
)ejωn
dω
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.
where w (n) is window
function
h(n) = hd (n)w (n)
2
FIR Filter
Design
UNIT - 7: FIR Filter 26 /
October 25,
4
5
Obtain the H(z ) for h(n) by taking z transform
Obtain the magnitude response |H(ejω
)| and phase response θ(ω)|
FIR Filter
Design
UNIT - 7: FIR Filter 27 /
October 25,
1
0p 
1
0p 
1 1
0 1 2 3 4 
Low-pass filter is used to eliminate high-frequency fluctuations (eg. noise filtering,
demodulation, etc.)
High-pass filter is used to follow small-amplitude high-frequency perturbations in
presence of much larger slowly-varying component (e.g. recording the
electrocardiogram in the presence of a strong breathing signal)
Band-pass is used to select a required modulated carrier signal (e.g. radio)
Band-stop filter is used to eliminate single-frequency (e.g. mains) interference (also
known as notch filtering)
Hd () Hd ()
Low pass Filter
Hd ()

Hd ()

High pass Filter
0 1 2

 
FIR Filter
Design
UNIT - 7: FIR Filter 28 /
October 25,
Band pass Filter
Band stop pass Filter
Figure 5: Frequency response characteristic of different types of filters
FIR Filter
Design
UNIT - 7: FIR Filter 29 /
October 25,
Different Types of
Windows
Rectangular:
Hanning
Hamming:
Blackman:
Bartlett (Triangular)
Window Kaiser window
R
2
30 /
October 25,
UNIT - 7: FIR Filter
Rectangular window
wR (n)
This is the simplest window
function but provides the worst
performance from the viewpoint
of stopband attenuation.
The width of main lobe is 4π/N
ω (n) =
1 for n = 0, 1, M − 1
0 otherwise
Magnitude response of
rectangular window is
n
0 1 2 3 4 5 6 M-1
Figure 6: Rectangular window
| sin( ωM
)|
|WR (ω)| = 2
| sin( ω
)|
31 /
October 25,
UNIT - 7: FIR Filter
Figure 7:
Rectangular window
32 /
October 25,
UNIT - 7: FIR Filter
Bartlett (Triangular) Window
0 1 2 3 4 5 6 M-1
wT
(n)
n
Figure 8: Bartlett window
Bartlett Window is also
Triangular window.
The width of main lobe is 8π/M
2|n − M−1
|
ωT (n) = 1 − 2
M − 1
33 /
October 25,
UNIT - 7: FIR Filter
Figure 9: Bartlett
window
M
UNIT - 7: FIR Filter October 25, 34 /
Hanning window
n
0 1 2 3 4 5 6 M-1
This is a raised cosine window function given by:
w (n) =
1
1 − cos
2πn
W (ω) ≈
0.5WR
2
(ω) + 0.25 WR
M − 1
2π
(ω − ) + WR
M
(ω +
2π
)
M
The width of main lobe is: 8π
wH (n)
UNIT - 7: FIR Filter October 25, 35 /
Figure 10: Hanning window
Figure 11: Hanning window
M −
M
UNIT - 7: FIR Filter October 25, 36 /
Hamming window
0 1 2 3 4 5 6 M-1
This is a modified version of the raised cosine window
w (n) = 0.54 − 0.46 cos
2πn
W (ω) ≈
0.54WR
The width of main lobe is: 8π
(ω) + 0.23 WR
2π
(ω − ) + WR
M
(ω +
2π
)
M
wH (n)
n
UNIT - 7: FIR Filter October 25, 37 /
Figure 12: Hamming window
Figure 13: Hamming window
M
M
M − M −
+0.04
W
(ω + 4π
)
M M
UNIT - 7: FIR Filter October 25, 38 /
Blackman window
This is a 2nd
-order raised cosine window.
w (n) = 0.42 − 0.5 cos
2πn
+ 0.08 cos
4πn
W (ω) ≈ 0.42WR (ω) + 0.25 WR (ω − 2π
) + WR (ω + 2π
)
The width of main lobe is: 12π
wT (n)
R (ω − 4π
) + R M
UNIT - 7: FIR Filter October 25, 39 /
n
0 1 2 3 4 5 6 M-1
Figure
14:
Blackma
n
window
15:
Blackma
n
window
M
Figure 16: Kaiser w 17: Kaiser
UNIT - 7: FIR Filter October 25, 40 /
Kaiser window
n
0 1 2 3 4 5 6 M-1
This is one of the most useful and optimum windows.
w (n) =
I0
,
β
r
1 − 1 − 2n
2
!
I0(β)
Where I0(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)
FIR Filter Design Window Design
Techniques
Window
name
Transition
width of
main lobe
Min. stopband
attenuation
Peak
value of
side lobe
Rectangular 4π
M+1 -
21
dB -21 dB
Hanning 8π
M -
44
dB -31 dB
Table 1: Window and its functions
Window name Window Function
Rectangular
ωR (n) =
1 for 0 ≤ n ≤ M − 1
0 otherwise
Triangular
(Bartlet)
2|n−
M−1
|
ωT (n) = 1 − M−
2
1
h i
Hamming w (n) = 0.54 − 0.46 cos 2πn
N−1
h i
Hanning w (n) = 0.5 − 0.5 cos 2πn
N−1
h i
Blackman w (n) = 0.42 − 0.5 cos 2πn
+ 0.08 cos 4πn
N−1 N−1
Table 2: Summary of window function characteristics
FIR Filter Design Window Design
Techniques
26 /
October 25,
UNIT - 7: FIR Filter
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 .
FIR Filter Design Window Design
Techniques
27 /
October 25,
UNIT - 7: FIR Filter
Figure 18: LPF designed with
rectangular window M=61 and
101
Figure 19: LPF designed with Hamming,
Hanning and Blackman window M=61
2
d
0
1
2
π
FIR Filter Design Low Pass FIR Filter
Design
UNIT - 7: FIR Filter October 25, 28 /
1
H (e j )
d
Design a LPF using rectangular window for the desired frequency response of a low pass
filter given by ωc = π rad/sec, and take M=11. Find the values of h(n). Also plot the
magnitude
response
.
Solution:
jω

 e−jωτ − ωc ≤ ω ≤ ωc
Hd
(e
) = 0 − π ≤ ω ≤ −ωc

0 ωc ≤ ω ≤ π
M − 1
τ = = 5
2
 

0
2
 

2
H (ejω
) =
e−jωτ
− ωc ≤ ω ≤ ωc
Figure 20: Frequency response of LPF
By taking inverse Fourier
transform
∫
hd (n) Hd
j
)
j
d
∫ h
∫
FIR Filter Design Low Pass FIR Filter
Design
UNIT - 7: FIR Filter October 25, 29 /
1
"
ejω(n−τ )
#ωc
1 ωc
= 2π
−ωc
e−jωτ
ejωn
dω =
1
ejωc (n−τ )
− e−jωc (n−τ )
2jπ(n − τ )
1 ωc
=
ejω(n−τ )
dω 1
"
ejωc (n−τ )
− e−jωc (n−τ )
#
2π −ωc π(n − τ ) 2j
hd (n)
=
2 j
(n − −
2
0
FIR Filter Design Low Pass FIR Filter
Design
October 25, 30 /
UNIT - 7: FIR Filter
h (n) =
sin [ωc (n − τ )]
π(2−5)
d
π(n − τ )
for n /= 5 and ωc = π , τ = M−1 =
5
sin
hd (2) = 2
π(2 − 5)
π(3−5)
= −0.106
2 2
hd (3) = sin 2
= 0
h (n) =
sin [ωc (n − 5)]
=
sin
h
π(n−5)
i π(3 − 5)
sin
π(4−5)
d
π(n − 5) π(n − 5) hd (4) =
2
= .318
π(4 − 5)
for n=5 hd (n) = 0
. Using L Hospital’s Rule
sin Bθ
lim = B
hd (5) =
sin
π(5−5)
2
= .5
π(5 − 5)
sin
π(6−5)
θ→0 θ hd (6) =
2
= .318
π(6 − 5)
sin π
(n − 5)
lim 2
= π/2
= 0.5 hd (7) =
sin
π(7−5)
2
= 0.0
n→5 π(n − 5) π π(7 − 5)
where π = 3.1416
hd (0) = sin
π(0−5)
2
= 0.0637
π(0 − 5)
hd (8) =
FIR Filter Design Low Pass FIR Filter
Design
October 25, 31 /
UNIT - 7: FIR Filter
hd (9) =
sin
π(8−5)
2
= −.106
π(8 − 5)
sin
π(9−5)
2
= 0
sin
π(1−5) π(9 − 5)
π(10−5)
hd (1) = 2
= 0
π(1 − 5) hd (10) =
sin
2
= .063
π(10 − 5)
Σ
Σ
Σ
FIR Filter Design Low Pass FIR Filter
Design
32 /
October 25,
UNIT - 7: FIR Filter
The given window is rectangular window
ω(n) =
1 for 0 ≤ n ≤ 10
0 Otherwise
This is rectangular window of length M=11. h(n) = hd (n)ω(n) = hd (n) for 0 ≤ n ≤ 10
M−1 10
H(z ) =
Σ
h(n)z −n
=
Σ
h(n)z −n
n=0 n=0
The impulse response is symmetric with M=odd=11
H(z ) = h
M − 1
z
M−3
2 +
M−3
2
n=0
h(n)[z −n
+ z (M−1−n)
]
= h(5)z −5
+ h(0)[z −0
+ z −10
] + h(1)[z −1
+ z −9
] + h(2)[z −2
+ z −8
] +
= +h(3)[z −3
+ z −7
] + h(4)[z −4
+ z −6
]
|H(ejω
)| = h
M − 1
+ 2
4
M−3 2
n=0
h(n)cos ω
2
2
FIR Filter Design Low Pass FIR Filter
Design
33 /
October 25,
UNIT - 7: FIR Filter
M − 1
—
n
2
= h(5) + 2 h(n)cos ω(5 − n)
n=0
= h(5) + 2h(0)cos 5ω + 2h(1)cos 4ω + 2h(2)cos 3ω + 2h(3)cos 2ω + 2h(4)cos ω
= 0.5 + 0.127cos 5ω − 0.212cos 3ω + 0.636cos ω
FIR Filter Design Low Pass FIR Filter
Design
34 /
October 25,
UNIT - 7: FIR Filter
|H(ejω
)| = 0.5 + 0.127cos 5ω − 0.212cos 3ω + 0.636cos ω
|H(ejω
)|dB = 20log |H(ejω
)| 10
0
10
−
20
−
30
−
40
−
50
−
60
−
, 0 to  in radians
Figure 21: Frequency response of LPF
|
0 0.5 1 1.5 2 2.5 3 3.5
ω |H(ejω
)| |H(ejω
)|dB
0 1.0151 -0.44
0.1π 0.9808 -0.17
0.2π 0.9535 -0.41
0.3π 1.0758 0.63
0.4π 0.9952 -0.04
0.5π 0.5 -6.02
0.6π 0.0048 -46.37
0.7π 0.0758 -22.41
0.8π 0.0467 -26.65
0.9π 0.0192 -34.35
1.0π 0.0512 -25.74
4
∫
)
0
4
∫
FIR Filter Design Low Pass FIR Filter
Design
35 /
October 25,
UNIT - 7: FIR Filter
1
H (e j )
d
  3
0
3 
The desired frequency response of low pass filter is given by
jω e−j3ω − 3π
≤ ω ≤ 3π
π
≤ |ω| ≤ π
Determine the frequency response of the FIR if Hamming window is used with N=7 June-
2015, Dec-2014, June-2012
Solution:
hd (n) = 1
∫
π Hd (ejω
)ejωn
dω
M − 1
τ = = 3
2
2π −π
1 ωc
=
e−jωτ
ejωn
dω
2π −ωc
1 ωc
= 2π
−ωc
ejω(n−τ )dω

4 4
1
"
ejω(n−τ )
#ωc
2π j(n − τ ) −ωc sinωc (n − τ )
Hd
=
FIR Filter Design Low Pass FIR Filter
Design
36 /
October 25,
UNIT - 7: FIR Filter
1
"
ejωc (n−τ )
− e−jωc (n−τ )
# hd (n) =
π(n − τ )
π(n − τ ) 2j
=
sin
sin
4
0
4
4
4 2
d
FIR Filter Design Low Pass FIR Filter
Design
37 /
October 25,
UNIT - 7: FIR Filter
π(n −
n /= 3 ωc = 3π τ = M−1 =
3
hd (0) =
hd (1) =
3π(0−3)
4
π(0 − 3)
3π(1−3)
4
π(1 − 3)
3π(2−3)
= 0.075
= −0.159
h (n) = sin
h
3π(n−3)
i π(2 − 3)
3π(3−3)
for n=3 hd (n) = 0
. Using L Hospital’s
Rule
hd (4) =
π(3 − 3)
sin
3π(4−3) = 0.225
lim sin
3π
(n − 3)
3π/4
= = 0.75
π(4 − 3)
3π(5−3)
hd (2)
s
=
hd (3)
s
=
n π
hd (5)
s
=
4
π(n −
4
4
sin
FIR Filter Design Low Pass FIR Filter
Design
38 /
October 25,
UNIT - 7: FIR Filter
hd (6) =
π(5 − 3)
3π(6−3)
4
π(6 − 3) = 0.075
6
6
FIR Filter Design Low Pass FIR Filter
Design
39 /
October 25,
UNIT - 7: FIR Filter
The given window is Hamming window
M − 1
6
4π
6
8π
= 1
= 0.77
h(5) = hd (5)w (5) = −0.159 × 0.31 = −0.049
10π
= .31 0.54 − 0.46cos
12π
= .08
6
w (n) =
ω(0) =
ω(1) =
ω(2) =
ω(3) = 0.54 − 0.46cos
ω(4) = 0.54 − 0.46cos
ω(5) = 0.54 − 0.46cos
ω(6) =
0.54 − 0.46cos
2πn
0.54 − 0.46cos
0
= 0.08
0.54 − 0.46cos
2π
= .31
To calculate the value of h(n)
h(n) = hd (n)w (n)
6
h(0) = hd (0)w (0) = 0.075 × 0.08 = 0.006
0.54 − 0.46cos = .77
6 h(1) = hd (1)w (1) = −0.159 × 0.31 = −0.049
6π
h(2) = hd (2)w (2) = 0.225 × 0.77 = 0.173
FIR Filter Design Low Pass FIR Filter
Design
40 /
October 25,
UNIT - 7: FIR Filter
h(6) = hd (6)w (6) = 0.075 × 0.08 =
0.006
Σ
Σ
FIR Filter Design Low Pass FIR Filter
Design
October 25, 41 /
UNIT - 7: FIR Filter
The frequency response is symmetric with M=odd=7
|H(ejω
)| = h
M − 1
+ 2
2
M−3
2
n=0
h(n)cos ω
M − 1
— n
2
= h(3) + 2 h(n)cos ω(3 − n) = h(3) + 2h(0)cos 3ω + 2h(1)cos 2ω + 2h(2)cos ω
n=0
= 0.75 + 0.012cos 3ω − 0.098cos 2ω + 0.346cos ω
|H(ejω
)|dB = 20log |H(ejω
)|
ω |H(ejω
)| |H(ejω
)|dB
0 1.0100 0.0864
0.1π 1.0068 0.0592
0.2π 0.9959 -0.0354
0.3π 1.9722 -0.2445
0.4π 0.9265 -0.6631
0.5π 0.8480 -1.4321
0.6π 0.7321 -2.7089
0.7π 0.5883 -4.6077
0.8π 0.4435 -7.0620
0.9π 0.3346 -9.5095
1.0π 0.2940 -10.6331
2
FIR Filter Design Low Pass FIR Filter
Design
October 25, 42 /
UNIT - 7: FIR Filter
0
−2
−4
−6
−8
−10
2
12
−
, 0 to  in radians
Figure 22: Frequency response of
LPF
|
0 0.5 1 1.5 2 2.5 3 3.5
FIR Filter Design Low Pass FIR Filter
Design
October 25, 43 /
UNIT - 7: FIR Filter
Matlab code
clc; clear all; close all;
M= input(’enter the value of M:’);
omega= input(’enter the value of omega:’);
tau=(M-1)/2 ;
for n=0:M-1;
% c(n+1)=.5-.5*cos((2*pi*n)/(M-1));
c(n+1)=.54-.46*cos((2*pi*n)/(M-1));
if n==tau
h(n+1)=omega/pi;
else
h(n+1)=sin(omega*(n-tau))/(pi*(n-tau));
end
end
h
c
for n=1:M
y=h(n)*c(n)’
end
FIR Filter Design Low Pass FIR Filter
Design
44 /
October 25,
UNIT - 7: FIR Filter
clc; clear all; close all;
range=0;
%M= input(’enter the value of M:’);
for omega=0:.1*pi:pi
range=range+1;
H_omega=abs(0.75+.012*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:pi;
i=1:range;
plot(omega, H_indB(i),’linewidth’,2 ) xlabel(’
omega, 0 to pi in radians’,’fontsize’,13) ylabel(’
|H(e^{jw})|_{dB}’,’fontsize’,13)
∫
)
0
4 4
2jπ(n −
e — 4
∫
FIR Filter Design Low Pass FIR Filter
Design
Dr. Manjunatha. P (JNNCE) October 25, 45 /
UNIT - 7: FIR Filter
1
Hd (e )
j
Determine the filter coefficients hd (n) for the desired frequency response of a low pass
filter given by
jω e−2jω
for − π
≤ ω ≤ π
4
≤ |ω| ≤ −π
If we define the new filter coefficients by hd (n) = hd (n)ω(n) where
ω(n) =
1 for 0 ≤ n ≤ 4
0 otherwise
Determine h(n) and also the frequency response H(ejω
) July-2013, July-2011
Solution:
hd (n) =
1
∫
π
Hd (ejω
)ejωn
dω
2π −π
1 π/4
=
2π −π/4
e−j2ω
ejωn
dω  

0  

4 4
1 π/4
=
ejω(n−2)
dω
2π −π/4
1
"
ejω(n−2)
#π/4 1
h
j π
(n−2) −j π
(n−2)
i
Hd
=
2 j(n −
hd (n)
π(n −
4
2
4
FIR Filter Design Low Pass FIR Filter
Design
Dr. Manjunatha. P (JNNCE) October 25, 46 /
UNIT - 7: FIR Filter
−π/4
1
"
ej π
(n−2)
− e−j π
(n−2)
#
=
FIR Filter Design Low Pass FIR Filter
Design
47 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
n /=
2
sin
π(n−2)
hd (n) = 4
π(n − 2)
The given window function is
ω(n) =
1 for 0 ≤ n ≤ 4
0 Otherwise
This is rectangular window of length M=5.
for n=2 h (n) = 0
. Using L Hospital’s Rule In this case h(n) = hd (n) for 0 ≤ n ≤ 4
d 0
sin π (n − 2) π/4
lim 4
= = 0.25
n→2 π(n − 2) π
n hd (n) n hd (n)
0 0.159091 3 0.224989
1 0.224989 4 0.159091
2 0.25
Σ
Σ
FIR Filter Design Low Pass FIR Filter
Design
48 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
The frequency response is symmetric with M=odd=5
|H(ejω
)| = h
M − 1
+ 2
1
M−3
2
n=0
h(n)cos ω
M − 1
— n
2
= h(2) + 2 h (2 − n) cos ωn = h(2) + 2h(0)cos 2ω + 2h(1)cos ω
n=0
= 0.25 + 0.318cos 2ω + 0.45cos ω
|H(ejω
)|dB = 20log |H(ejω
)|
ω |H(ejω
)| |H(ejω
)|dB
0 1.0180 0.1550
0.1π 0.9352 -0.5815
0.2π 0.7123 -2.9464
0.3π 0.4162 -7.6132
0.4π 0.1318 -17.6023
0.5π 0.0680 -23.3498
0.6π 0.1463 -16.6936
0.7π 0.1128 -18.9561
0.8π 0.0158 -36.0322
0.9π 0.0793 -22.0154
1.0π 0.1180 -18.5624
2
FIR Filter Design Low Pass FIR Filter
Design
49 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
0
−10
−20
−30
−40
−50
10
60
−
, 0 to  in radians
Figure 23: Frequency response of LPF
|
0 0.5 1 1.5 2 2.5 3 3.5
FIR Filter Design Low Pass FIR Filter
Design
50 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
1
H (e j )
d
Design the symmetric FIR lowpass filter whose desired frequency response is given as
Hd (ω
) =
e−jωτ 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
(ω) Length of the filter M=7
Cut-off frequency ωc = 1
radians/sample. Unit sample response
is defined as

hd (n) =
1
∫
π
Hd (ejω
)ejωn
dω  1 0 1 
2π −π
FIR Filter Design Low Pass FIR Filter
Design
51 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
Given Hd (ω) is
Figure 24: Frequency response
of LPF
Hd (ω) =
e−ωτ
for − 1 ≤ ω ≤ 1
0 Otherwise
∫
∫
" #
FIR Filter Design Low Pass FIR Filter
Design
52 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
hd (n) = 1 1
2π −1
e−ωτ
ejωn
dω
Determine the value of τ
M — 1
τ = = 3
1 1
= 2
ejω(n−τ )
dω
2π −1
1 eω(n−τ )
1
=
hd (n) =
sin(n−3)
π(n−3)
1
π
for n /= τ
for n = τ
2π j(n — τ )
−1 This is rectangular window of length M=7.
sin(n — τ
)
=
π(n — τ )
for n /=
τ
In this case h(n) = hd (n).w (n) = hd (n)
for n = τ hd (n) = 0
. Using L Hospital’s
Rule
lim
n→τ
0
sin(n — τ ) 1
=
π(n — τ ) π
,
n h(n) n h(n)
0 0.015 4 0.2678
1 0.1447 5 0.14472
2 0.2678 6 0.15
3 0.3183
FIR Filter Design Low Pass FIR Filter
Design
53 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
Thus hd (n)
is
hd (n) =
sin(n−τ )
π(n−τ )
1
π
for n /= τ
for n = τ
This is the unit sample response of
required FIR filter. The filter is symmetric
and satis- fies h(n) = h(M — 1 — n)
,
FIR Filter Design Low Pass FIR Filter
Design
October 25, 54 /
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
Design the FIR filter using Hanning window
Solution:For M=7
ω(n) = 0.5(1 — cos
ω(n) = 0.5(1 — cos
2πn
)
M — 1
2πn
)
6
To calculate the value of h(n)
h(n) = hd (n)w (n)
ω(0) = 0.0
2π
ω(1) = 0.5(1 — cos ) = .25
6
4π
ω(2) = 0.5(1 — cos ) = .75
6
6π
h(0) = hd (0)w (0) = 0.01497 × 0 = 0
h(1) = hd (1)w (1) = 0.014472 × 0.25 = 0.03618
h(2) = hd (2)w (2) = 0.26785 × 0.75 = 0.20089
h(3) = hd (3)w (3) = 0.31831 × 1 = 0.31831
ω(3) = 0.5(1 — cos
ω(4) = 0.5(1 — cos
ω(5) = 0.5(1 — cos ω(6) = 0.5(1 — cos
) = 1
6
8π) = .75
h(4)
h(5)
=
=
hd (4)w (4) = 0.26785 × 0.75 = 0.20089
hd (5)w (5) = 0.14472 × 0.25 = 0.03618
6
10π
h(6) = hd (6)w (6) = 0.014497 × 0.0 = 0
FIR Filter Design Low Pass FIR Filter
Design
October 25, 55 /
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
6
12π 6
) =
.25
) =
0
FIR Filter Design Low Pass FIR Filter
Design
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter October 25, 56 /
1
H (e j )
d
Design a lowpass digital filter to be used in an A/D Hz D/A structure that will have a -3
dB cut-off at 30 π rad/sec and an attenuation of 50 dB at 45 π rad/sec. The filter is
required to have linear phase and the system will use sampling rate of 100
samples/second.
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
As =50 dB for ωs = 45πrad/sec
ω =
Ω
Fsf
ω =
Ω1
=
30π
= 0.3π rad/sample  

Fsf 100 0.3
0
0.3 
ω =
Ω2
=
45π
= 0.45π rad/sample Figure 25:
Fsf 100 Frequency response of LPF
1
2
FIR Filter Design Low Pass FIR Filter
Design
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter October 25, 57 /
3 dB attenuation at ω1 = 0.3π rad/sample
50 dB attenuation at ω2 = 0.45π rad/sample
M
∫
FIR Filter Design Low Pass FIR Filter
Design
58 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
Type of window is
The stopband attenuation of 50
dB is provided by the Hamming
window which of -53 dB. Hence
Hamming win- dow is selected for
the given specifica-
Hd (ω) =
e−jωτ for —
ωc
0 Otherwise
≤ ω ≤ ωc
tions.
To determine the order of the filter
The width of the main lobe in
Ham-
τ = (M — 1)/2 = 55 — 1/2 = 27
ωc = 0.3π
ming window is 8π
2π 8π
hd (n) =
1 ωc
2π
−ωc
e−jωτ
ejωn
dω
k =
M M = 1
∫ 0.3π
ejω(n−27)
dω
2π −0.3π
8π
M =
ω2 — ω1 1
"
eω(n−27)
#0.3π
The order of the filter M
is:
2π j(n — 27) −0.3π
8π M = 0.45π — 0.3π
=
FIR Filter Design Low Pass FIR Filter
Design
59 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
= 53.33 =
sin
(n
27)]
π(n — 27)
when n = 27
for n /= 27
Assume linear phase FIR filter of
odd
length Hence select next odd
integer
h (n) =
ωc
= 0.3
d
length of 55. π
M
FIR Filter Design Low Pass FIR Filter
Design
60 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
The selected window is Hamming M=27
2πn
= 0.54 — 0.46cos
πn
18
The value of h(n)
h(n) = hd (n)w (n)
for M= 27
h(n) =
sin[0.3π(n — 27)]
π(n — 27) 0.54 —
0.46cos
πn i
for n /= 27 h
(n
) = 0.3
h
w (n) = 0.54 —
n h(n) n h(n)
0 0.0 28 0.2567
1 0.0 29 0.1495
2 -0.0012 30 0.0319
3 0.0 31 -0.0445
4 0.0 32 -0.0588
5 0.0021 33 - 0.0278
6 0.0023 34 0.012
7 0.0 35 0.0308
8 -0.0036 36 0.0220
9 -0.0052 37 -0.0
10 -0.0021 38 -0.0157
11 0.0048 39 -0.0156
12 0.0098 40 -0.0043
13 0.0069 41 0.0069
14 -0.0043 42 0.0098
15 -0.0156 43 0.0048
16 -0.0157 44 -0.0021
17 0.0 45 -0.0052
18 0.0220 46 -0.0036
19 -0.0308 47 0.0
20 -0.0120 48 0.0023
21 -0.0278 49 0.0021
22 -0.0588 50 0.0
23 -0.0445 51 0.0
24 0.0319 52 -0.0012
25 0.1495 53 0.0
26 0.2567 54 0.0
27 0.3
1
FIR Filter Design Low Pass FIR Filter
Design
61 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
h
0.54 — 0.46cos
πn i
1
FIR Filter Design Low Pass FIR Filter
Design
62 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
1
H (e j )
d
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 45 π rad/sec
As =50 dB for ωs = 45πrad/sec
ω =
Ω
Fsf
ωp = Ω
p
Fsf
2π × 10 × 103
=
50 × 103
= 0.4π
 0.5
0
0.5 

ωs = Ω
s
Fsf 2π × (10 + 5) × 103
=
50 × 103
= 0.6π
FIR Filter Design Low Pass FIR Filter
Design
63 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
Figure 2 6: Frequency response of LPF
ωp = 0.4π rad/sample
ωs = 0.6π rad/sample
FIR Filter Design Low Pass FIR Filter
Design
October 25, 64 /
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
Type of window is
The stopband attenuation of 50
dB is provided by the Hamming
window which of -53 dB. Hence
Hamming win-
Hd
(ω
) =
e−jωτ for — ωc ≤ ω ≤ ωc
0 Otherwise
dow is selected for the given
specifica- tions.
τ = (M — 1)/2 = 41 — 1/2 = 20
ωc = ωp + ∆ω = 0.4π + 0.2π
To determine the order of the filter
The width of the main lobe in
Ham- ming window is 8π
ωc = 0.5π
2 2
1
∫
ωc
M
2π 8π
k =
hd (n) = 2π
−ωc
e−jωτ
ejωn
dω
M M
=
1
∫ 0.5π
ejω(n−20)
dω
8π
2π
−0.5π
M ≥
ωs — ωp
1
"
eω(n−27)
#0.5π
The order of the filter M
is:
2π j(n — 20)
−0.5π
8π
M ≥
0.6π 0.4π
=
FIR Filter Design Low Pass FIR Filter
Design
October 25, 65 /
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
≥ 40 =
si
n[ωc (n — 20)]
for n /= 20
π(n — 20)
Assume linear phase FIR filter of
odd length Hence select next odd
integer length of 41.
when n = 20
hd (n) =
ωc
=
π
0.5π
= 0.5
π
FIR Filter Design Low Pass FIR Filter
Design
66 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
M
2
The selected window is Hamming M=41
2πn
= 0.54 — 0.46cos
2πn
40
The value of h(n)
h(n) = hd (n)w (n)
for M= 41 n /= 20
h(n) =
sin[0.5π(n — 20)]
π(n — 20) 0.54 —
0.46cos
2πn
for n = 20
w (n) = 0.54 —
n h(n) n h(n)
0 0.0 21 0.3148
1 -0.00146 22 0.0
2 0.0 23 -0.1
3 -0.00247 24 0.0
4 0 25 0.055
5 -0.00451 26 0.0
6 0.0 27 -0.0337
7 0.0079 28 0.0
8 0.0 29 0.0213
9 -0.0136 30 0.0
10 0.0 31 -0.0136
11 0.002135 32 0.0
12 0.0 33 0.0079
13 -0.03375 34 0
14 0.0 35 -0.0045
15 0.05504 36 0.0
16 0.0 37 0.0024
17 -0.1006 38 0.0
18 0.0 39 -0.0014
19 0.3148 40 0.0
20 0.5
2
FIR Filter Design Low Pass FIR Filter
Design
67 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
h(n) = 0.5 0.54 — 0.46cos
2πn
F
∫
1
"
eω(n−3)
∫
FIR Filter Design Low Pass FIR Filter
Design
Dr. Manjunatha. P (JNNCE) October 25, 68 /
UNIT - 7: FIR Filter
1
H (e j )
d
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:
Fc = 200 Hz, Fs = 1000 Hz,
fc = Fc 200
= 0.2cycles/sample
s
ωc = 2π ∗ fc = 2π × 0.2 = 0.4πrad
M=7
Hd (ω) = e−jωτ for — ωc ≤ ω ≤ ωc
0 Otherwise
 0.4
0
0.4  

τ = (M — 1)/2 = 7 — 1/2 = 3
ωc = 0.4π
Figure 27: Frequency response of LPF
when n /= 3
hd (n) = 1 ωc
2π
−ωc
e−jωτ
ejωn
dω
h (n) = sin[0.4π(n — 3)]
1 0.4π
=
2π −0.4π
ejω(n−3)
dω
d
π(n — 3)
FIR Filter Design Low Pass FIR Filter
Design
Dr. Manjunatha. P (JNNCE) October 25, 69 /
UNIT - 7: FIR Filter
when n = 3
=
2π j(n — 3)
−0.4π
hd (n) =
0.4π
= 0.4
π
FIR Filter Design Low Pass FIR Filter
Design
70 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
Determine the value of h(n)
Since it is rectangular window h(n) = w (n) = hd (n) = h(n)
For M=7
n h(n) n h(n)
0 -0.062341 4 -0.062341
1 0.093511 5 0.093511
2 0.302609 6 0.302609
3 0.4
F
FIR Filter Design Low Pass FIR Filter
Design
71 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
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 = Fc 1000
= 0.2cycles/sample
s
ω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
∫
 
∫
FIR Filter Design Low Pass FIR Filter
Design
72 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
1
H (e j )
d
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.
Solution: The linear phase FIR filter is nor-
malized means its cut-off frequency is of ωc =
1rad/sample
The length of the filter with given τ is related by
M — 1 
τ = 1 0 1
2
For τ = 4 M=9
Desired unit sample response hd (n)
is
Figure 28: Frequency response
of LPF
hd (n) =
1 ωc
2π
−ωc
e−jωτ
ejωn
dω
when n /=
4 sin[(n — 4)]
1 1
=
hd (n) =
1dω = =
FIR Filter Design Low Pass FIR Filter
Design
73 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
ejω(n−4)
dω hd (n) =
π(n — 4)
2π −1
1
"
eω(n−4)
#1
when n = 4
2π j(n — 4)
−1
1
∫ 1
ω 1
=
−
π(0 — 4
π(3 — 4
h(3) =
sin(3 — 4)
0.5 — 0.5cos
3π
=
FIR Filter Design Low Pass FIR Filter
Design
74 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
h(n) = hd (n)w (n)
for n = 0 to 8
h(0) =
sin(0 — 4)
0.5 — 0.5cos
π0
= 0.0000
this filter is 40 dB. From the table the
h(1) =
sin(1 — 4)
0.5 — 0.5cos
π1
= 0.0022
Hanning window satisfies this
require-
ment. The Hanning window
function given by:
h(2) =
π(1 — 4)
sin(2 — 4)
π(2 — 4)
0.5 —
0.5cos
4
2π = 0.0724
M — 1
h(4) =
sin(4 — 4)
0.5 — 0.5cos
4π
= 0.3183
for n /= 4 and M = 9 π(4 — 4) 4
h(5) =
sin(5 — 4)
0.5 — 0.5cos
5π
= 0.2286
h(n) = sin(n — 4)
π(n — 4)
0.5 —
0.5cos
πn i
h(6) =
π(5 — 4)
sin(6 — 4)
π(6 — 4) 0.5 —
0.5cos
4
6π = 0.0724
for n = 4
h
4
4
w (n) = 0.5 —
π
The stopband attenuation
4
2
4
FIR Filter Design Low Pass FIR Filter
Design
75 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
4
4
h(n) =
1
π
0.5 —
0.5cos
π4
=
1
h(7) =
h(8) =
sin(7 — 4)
π(7 — 4)
sin(8 — 4)
π(8 — 4)
0.5 —
0.5cos
0.5 —
0.5cos
7π
8π
= 0.0022
= 0.0000
Σ
Σ
FIR Filter Design Low Pass FIR Filter
Design
UNIT - 7: FIR Filter 76 /
October 25,
Dr. Manjunatha. P (JNNCE)
The frequency response is symmetric with M=odd=9
|H(ejω
)| = h
M — 1
+ 2
3
M−3
2
h
n=0
M — 1
— n
2
cos ω
= h(4) + 2 h(n)cos ω (4 — n)
n=0
= h(4) + 2h(0)cos 4ω + 2h(1)cos 3ω + 2h(2)cos 2ω + 2h(3)cos ω
= 0.3183 + 0.044cos 3ω + 0.1448cos 2ω + 0.4572cos ω
|H(ejω
)|dB = 20log |H(ejω
)|
ω |H(ejω
)| |H(ejω
)|dB
0 1.0180 0.1550
0.1π 0.9352 -0.5815
0.2π 0.7123 -2.9464
0.3π 0.4162 -7.6132
0.4π 0.1318 -17.6023
0.5π 0.0680 -23.3498
0.6π 0.1463 -16.6936
0.7π 0.1128 -18.9561
0.8π 0.0158 -36.0322
0.9π 0.0793 -22.0154
1.0π 0.1180 -18.5624
2
FIR Filter Design Low Pass FIR Filter
Design
UNIT - 7: FIR Filter 77 /
October 25,
Dr. Manjunatha. P (JNNCE)
0
−10
−20
−30
−40
−50
10
60
−
, 0 to  in radians
Figure 29: Frequency response of LPF
|
0 0.5 1 1.5 2 2.5 3 3.5



∫
∫
d
0
∫
+
FIR Filter Design High Pass FIR Filter
Design
October 25, 78 /
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
H (e j )
1
d
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:
Hd (ejω
) = e−jωτ — π ≤ ω ≤ —ωc
e−jωτ ωc ≤ ω ≤ —π
0 — ωc ≤ ω ≤ ωc
M — 1
τ = = 3
2
H (ejω
) =
e−jωτ
— π ≤ —ω ≤ ωc
hd (n) =
1 π
2π −π
Hd (ejω
)ejωn
dω
 c 0 c  
1 −ωc
= [ ejω(n−τ )
π
dω + ejω(n−τ )
dω
2π −π ωc
1
"
ejω(n−τ )
#−ωc
1
"
ejω(n−τ )
#π
2π j(n — τ )
−π
2π j(n — τ ) ωc
=
FIR Filter Design High Pass FIR Filter
Design
October 25, 79 /
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
1
"
e−jωc (n−τ )
— e−jπ(n−τ )
+ ejπ(n−τ )
— ejωc (n−τ )
#
π(n — τ ) 2j
=
π
d
π (n — (n — π
c
π
π(n — M
FIR Filter Design High Pass FIR Filter
Design
80 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
hd (n) =
1
"
ejπ(n−τ )
— e−jπ(n−τ )
— ejωc (n−τ )
— e−jωc (n−τ )
#
π(n — τ )
1
=
π(n — τ )
2j
[sinπ(n — τ ) — sinωc (n — τ ]
τ = 3 ωc = 1 hd (n) = 1
[sinπ(n — 3) — sin(n — 3)] when
n = τ using L Hospital rule
h (n) =
1 sinπ(n — 3)
—
sinωc (n — 3)
=
1
[π — ω ] =
1
[π — 1]
The given window function is Hamming window. In this case h(n) = hd (n)ω(n)) for 0 ≤ n ≤ 6
w (n) = 0.54 — 0.46cos
2πn
M — 1
h(n) =
1
[sinπ(n — 3) — sin(n — 3)] × 0.54 — 0.46cos
2πn
n h(n) n h(n)
0 -0.00119 4 -0.00119
FIR Filter Design High Pass FIR Filter
Design
81 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
1 -0.00448 5 -0.00448
2 -0.2062 6 -0.2062
3 0.6816
Σ
Σ
FIR Filter Design High Pass FIR Filter
Design
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter October 25, 82 /
The magnitude response of a symmetric FIR filter with M=odd is
For M=7
|H(ejω
)| = h M — 1
+ 2
(M−3)
2
n=0
h(n)cosω
M — 1
— n
2
2
|H(ejω
)| = 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ω
2
2
−
∫
FIR Filter Design Band Pass FIR Filter
Design
83 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
H (e j )
1
d
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.
ω(n) =
1 for 0 ≤ n ≤ 6
0 Otherwise
Solution
:
Hd (ω) =
e−jωτ
ωc1
≤ |ωc | ≤ ωc2
0 Otherwise
1
∫
π jωn

c2
c1
0

c1
c 2  
1
"∫ −ωc1
e−jωτ
ejωn dω +
∫ ωc2
e−jωτ
ejωn dω
#
2π −ωc2 ωc1
1
"∫ −ωc1
ejω(n−τ )
ω
c2
+
ejω(n−τ )dω
#
2π −ωc2 ωc1
1
"
ejω(n−τ )
#−ωc1
"
ejω(n−τ )
#ωc2

hd (n) Hd
=
=
d
FIR Filter Design Band Pass FIR Filter
Design
84 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
=
2π

(n — τ
)
+
−ωc2
(n — τ ) ωc1

=
sinωc2 (n — τ ) — sinωc1 (n — τ
)
π(n — τ )
for n /= τ
ω −
1
FIR Filter Design Band Pass FIR Filter
Design
85 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
h (n) =
sinωc2 (n — τ ) — sinωc1 (n — τ )
d
=
ωc2 —
ωc1
π
π(n — τ )
for n = τ
,
sinωc2
(n−τ )−sinωc1
(n−τ
) for n /= τ
c2
c1
π
for n = τ
The linear phase FIR filter is normalized means
its cut-off frequency is of ωc = 1rad/sample
The length of the filter with given τ is related by
M — 1
τ = =
2
7 — 1
= 3
2
and ωc2 = 2 rad/sample ωc = 1rad/sample
,
sin2(n−3)−sin(n−3)
for n /= 3
π for n = 3 for
hd (n)
hd (n)
n h(n) n h(n)
0 -0.044 4 0.0215
1 -0.165 5 0.265
2 0.215 6 -0.044
3 0.3183
π
π
FIR Filter Design Band Pass FIR Filter
Design
86 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
The given window is rectangular hence
h(n) = hd (n)w (n) = hd (n)
Σ
Σ
FIR Filter Design Band Pass FIR Filter
Design
Dr. Manjunatha. P (JNNCE) 87 /
October 25,
UNIT - 7: FIR Filter
For n=0,1,2..6 estimate the FIR filter coefficients h(n).
For M=7 The magnitude response of the FIR filter is given by
H(ω) = h
M — 1
+ 2
M−3
2
n=0
h(n)cos ω
M — 1
— n
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.
2
2
−
∫
FIR Filter Design Band Pass FIR Filter
Design
Dr. Manjunatha. P (JNNCE) October 25, 88 /
UNIT - 7: FIR Filter
H (e j )
1
d
Design an ideal bandpass filter having frequency response
H e(jω)
for
π
≤ |ω| ≤
3π
d
4 4
Use rectangular window with N=11 in your design
Solution
:
Hd (ω) =
e−jωτ
ωc1
≤ |ωc | ≤ ωc2
0 Otherwise
1
∫
π jωn

c2
c1
0

c1
c 2  
1
"∫ −ωc1
e−jωτ
ejωn dω +
∫ ωc2
e−jωτ
ejωn dω
#
2π −ωc2 ωc1
1
"∫ −ωc1
ejω(n−τ )
ω
c2
+
ejω(n−τ )dω
#
2π −ωc2 ωc1
hd (n) Hd
=
=
d
FIR Filter Design Band Pass FIR Filter
Design
Dr. Manjunatha. P (JNNCE) October 25, 89 /
UNIT - 7: FIR Filter
1
"
ejω(n−τ )
#−ωc1
"
ejω(n−τ )
#ωc2

=
2π

(n — τ
)
+
−ωc2
(n — τ ) ωc1

=
sinωc2 (n — τ ) — sinωc1 (n — τ
)
π(n — τ )
for n /= τ
4 4
ω −

FIR Filter Design Band Pass FIR Filter
Design
90 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
h (n) =
sinωc2 (n — τ ) — sinωc1 (n — τ )
d
=
ωc2 — ωc1
π
π(n — τ )
for n = τ
,
sinωc2
(n−τ )−sinωc1
(n−τ
) for n /= τ
c2 c1
π
The length of the filter with given τ is related
by
M — 1
for n = τ for
11 — 1
τ = = = 5
2 2
and
ωc = π rad/sample ωc = 3π rad/sample
2 4 4


sin
h
3π(n−5)
i
−sin
h
π(n−5)
i
for n /= 5
hd (n) = π(n−5)
3π π
4
−
4
π for n = 5 for
The given window is rectangular hence
hd (n)
π
FIR Filter Design Band Pass FIR Filter
Design
91 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
h(n) = hd (n)w (n) = hd (n)
For n=0,1,2..10 estimate the FIR filter coefficients h(n).
∫
+
FIR Filter Design Band Pass FIR Filter
Design
October 25, 92 /
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
H (e j )
1
d
Design a BPF using Hanning window with M=7. Given that lower cutoff frequency
ωc1 = 2rad/sec and ωc2 = 3rad/sec.
Solution:
Hd (ejω
) =
e−jωτ
for — ωc2 ≤ ω ≤ —ωc1
e−jωτ
for ωc1 ≤ ω ≤ ωc2
0 for — ωc — ωc1ω ≤ ωc1
M — 1
τ = = 3
2
The inverse transform of the Hd (eω
) is
hd (n) = 1
∫
π
Hd (ejω
)ejωn
dω

c2
c1
0
c1
c 2  
2π −π
1 −ωc1
= [
ejω(n−τ )dω +
∫ ωc2
ejω(n−τ )
dω
2π −ωc2
ωc1
1
"
ejω(n−τ )
#−ωc1
1
"
ejω(n−τ )
#ωc1



=
FIR Filter Design Band Pass FIR Filter
Design
October 25, 93 /
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
2π j(n — τ )
1
−ωc2
2π j(n — τ )
ωc2
=
π(n — τ )
[sinωc2(n — τ ) — sinωc1(n — τ ]
d
FIR Filter Design Band Pass FIR Filter
Design
94 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
τ =
M−1
=
7−1
= 3
2 2
ωc1 = 2 rad/sec ωc2 = 3 rad/sec
for n /= 3
hd (n) = 1
π(n — 3)
[sin3(n — 3) — sin2(n — 3)]
for n = τ
h (n) =
1
lim
sinωc2(n — τ )
— lim
sinωc1(n — τ )
hd (n) = 1 1
[ωc2 — ωc1] =
π π
The given window function is Hanning window
ω(n) = 0.5 — 0.5cos 2πn
M —
1
π n (n — n (n —
n h(n) n h(n)
0 0 4 0
1 0.0189 5 0.0189
2 -0.01834 6 -0.01834
3 0.3183
π(n — M
FIR Filter Design Band Pass FIR Filter
Design
95 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
0 ≤ n ≤ M — 1
This is rectangular window of length M=11. In this case h(n) = hd (n)ω(n) = hd (n)
for 0 ≤ n ≤ 6
h(n) =
sin3(n — τ ) — sin2(n — τ )
0.5 — 0.5cos
2πn
Σ
Σ
Σ
Σ
FIR Filter Design Band Pass FIR Filter
Design
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter 96 /
October 25,
M−1 6
H(z ) =
Σ
h(n)z −n
=
Σ
h(n)z −n
= 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
= 0 + 0.0189z −1
— 0.1843z −2
+ 0.3183z −3
— 0.1834z −4
+ 0.0189z −5
+ 0
The magnitude response of a symmetric FIR filter with M=odd is
For M=7
|H(ejω
)| = h M — 1
+
(M−1)/2
2h
n=1
M — 1
— n
2
cosωn
3
|H(ejω
)| = h (3) + 2h (3 — n) cosωn
n=1
3
|H(ejω
)| = h (3) + 2h (3 — n) cosωn
n=1
5
= h(3) + 2h (5 — n) cosωn
n=1
= h(3) + 2h(2)cosω + 2h(1)cos2ω + 2h(0)cos3ω
2
n n
FIR Filter Design Band Pass FIR Filter
Design
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter 97 /
October 25,
= 0.3183 — 0.3668cosω + 0.0378 cos2ω
∫
∫
H (ejω
) =

e−jωτ
for — ωc1 ≤ ω ≤

∫
FIR Filter Design Bandstop FIR Filter
Design
October 25, 98 /
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
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:


e−jωτ
for — π ≤ ω ≤ —ωc2
d
e
−jωτ
for
ωc2

≤ ω ≤ π
hd (n) =
1 π
2π −π
Hd (ejω
)ejωn
dω
1 −ωc2
= [
ejω(n−τ )dω +
∫ ωc1
ejω(n−τ )
π
dω + ejω(n−τ )
dω
2π −π −ωc1 ωc2
1
"
ejω(n−τ )
#−ωc2
1
"
ejω(n−τ )
#ωc1
1
"
ejω(n−τ )
#π
0 for ωc1 ≤ |ω| ≤
= +
1
H (e j
)
d
   0
 


FIR Filter Design Bandstop FIR Filter
Design
October 25, 99 /
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
2π j(n — τ )
−π
1
2π j(n — τ )
−ωc1
2π j(n — τ )
ωc2
=
π(n — τ )
[sinωc1(n — τ ) + sinπ(n — τ — sinωc2(n — τ ]
+
d
FIR Filter Design Bandstop FIR Filter
Design
100 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
The inverse transform of the Hd (eω
) is
τ = M−1
= 5−1
= 2 ωc1 = 2 rad/sec ωc2 = 3 rad/sec
2 2
hd (n) = 1
π(n — 2)
[sin2(n — 2) + sinπ(n — 2) — sin3(n — 2)] for n /= 2
for n =
τ
h (n) =
1
lim
sinωc1(n — τ )
+ lim
sinπ(n — τ )
— lim
sinωc2(n — τ )
hd (n) = 1
[ωc1 + π — ωc2] =
π
1
[π — 1]
π
The given window function is Rectangular window
ω(n) = 1 0 ≤ n ≤ M — 1
This is rectangular window of length M=5.
In this case h(n) = hd (n)ω(n) = hd (n) for 0 ≤ n ≤ 4
π n (n — n (n — n (n —
FIR Filter Design Bandstop FIR Filter
Design
101 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
1
hd (n) =
π(n — 2)
[sin2(n — 2) + sinπ(n — 2) — sin3(n — 2)] for n /= 2
FIR Filter Design Bandstop FIR Filter
Design
102 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
n = 0 h(0) =
sin2(0 — 2) + sinπ(0 — 2) — sin3(0 — 2)
= —0.0759
π(0 — 2)
n = 1 h(1) =
sin2(1 — 2) + sinπ(1 — 2) — sin3(1 — 2)
= 0.2445
π(1 — 2)
n = 2 h(2) = 1
[π — 1] = 0.6817
π
n = 3 h(3) =
sin2(3 — 2) + sinπ(3 — 2) — sin3(3 — 2)
= 0.2445
π(3 — 2)
n = 4 h(4) =
sin2(4 — 2) + sinπ(4 — 2) — sin3(4 — 2)
= —0.0759
π(4 — 2)
M−1 4
H(z ) =
Σ
h(n)z −n
=
Σ
h(n)z −n
= h(0) + h(1)z −1
+ h(2)z −2
+ h(3)z −3
+ h(4)z −4
n n
FIR Filter Design Bandstop FIR Filter
Design
103 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
= —0.0759 + 0.2445z −1
+ 0.6817z −2
+ 0.2445z −3
— 0.0759z −4
Σ
Σ
Σ
FIR Filter Design Bandstop FIR Filter
Design
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter October 25, 104 /
The magnitude response of a symmetric FIR filter with M=odd is
For M=5
|H(ejω
)| = h M — 1
+
(M−1)/2
2h
n=1
M — 1
— n
2
cosωn
2
|H(ejω
)| = h (2) + 2h (2 — n) cosωn
n=1
3
|H(ejω
)| = 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ω
2
M
105 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
FIR Filter Design Using Kaiser Window
The Kaiser window is parametric and its bandwidth as well as its sidelobe energy
can be designed.
Mainlobe bandwidth controls the transition characteristics and sidelobe energy
affects the ripple characteristics.
The Kaiser window function is given by
wk (n) =
I0
"
α
r
1 —
2n
I0(α)
2
#
where M is the order of the filter, I0(x ) is a zeroth Bessel function of the first kind
Σ∞
1 x k
= 1 + 0.25x 2
(1!)2
+ (0.25x 2
)2
(2!)2
+ (0.25x 2
)3
(3!)2
+
I0(x ) = 1
k k 2
106 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
α = 0 if A < 21
= 0.5842(A — 21)0.4
+ 0.07886(A — 21) if 21 ≤ A ≤ 50 dB
= 0.1102(A — 8.7)) if A > 50 dB
FIR Filter Design FIR Filter Design Using Kaiser
Window
107 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
H ()
1 1
1
1 1
A˜P
1 Passband ripple
2 Stopband ripple
Ideal LPF
A˜
S
 2
PCS
Passband
Transitio
n band

Stopband
Ga
FIR Filter Design FIR Filter Design Using Kaiser
Window
108 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
Figure 30: Frequency response of LPF
d
2

 0 for A ≤
FIR Filter Design FIR Filter Design Using Kaiser
Window
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter October 25, 109 /
1
2
3
4
Kaiser Window Design Equations
Determine ideal frequency
response
H (ejω
) =
1 for |ω| ≤ ωc
0
for ωc ≤ |ω| ≤ π
where ωc = 1 (ωp + ωs )
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
100.05A˜
p −1
δ = min(δp, δs )
−0.05A˜
where δp = 0 ˜ and δs = 10 s
10 .05Ap +1
The actual stopband attenuation is
A = —20log10δ
The parameter α is
α = 0.5842(A — 21)0.4 + 0.07886(Aa — 21) for 21 < A ≤ 50
FIR Filter Design FIR Filter Design Using Kaiser
Window
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter October 25, 110 /

0.1102(A — 8.7) for A > 50
Σ
FIR Filter Design FIR Filter Design Using Kaiser
Window
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter October 25, 111 /
5
6
7
8
The value of M is found
by A — 7.95
M ≥
14.36∆f
where ∆f = ∆ω
=
ωs −ωp
and ∆ω is the width of transition band
2π 2π
Obtain impulse response by multiplying Kaiser window function
h(n) = hd (n)wk (n)
Obtain the causal finite impulse
response The system function is given
by
M−1
H(z ) = h(n)z −n
n=0
4
d
=
∫
FIR Filter Design FIR Filter Design Using Kaiser
Window
112 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
Design a lowpass filter with a cutoff frequencies from wc = π ∆ω = 0.02π and a stopband
ripple δs = 0.01. Use Kaiser window
Solution:
H (ejω
) =
1 for |ω| ≤ ωc
0 for ωc ≤ |ω| ≤ π
The inverse transform of the Hd (ejω
)
is
A = —20logδs
= —20log (0.01) = 40 dB
hd (n) = 1
∫
π
Hd (ejω
)ejωn
dω
α = 0.5842(A — 21)0.4
+ 0.07886(A — 21)
0.4
2π −π = 0.5842(40 — 21) + 0.07886(40 — 21)
1 ωc
=
ejωn
dω
= 3.4
2π −ωc
1 ejωn ωc
0.02π
= ∆f
2
j
−
h
FIR Filter Design FIR Filter Design Using Kaiser
Window
113 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
=
1
ejωc n
— e−jωc n
2jπn
1 ejωc n — e−jωc n
A —
7.95
M ≥
14.36∆f
≥ 223.189 ' 225
=
πn 2j
=
sinωc n
πn
225 —
1
τ =
2
= 112
M
I0 3.4
,
1 —
FIR Filter Design FIR Filter Design Using Kaiser
Window
114 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
2
#
I0
"
α
r
1 —
2n
wk (n) =
wk (n) =
0 ≤ n ≤ M — 1
I0(α)
2n 2
224
0 ≤ n ≤ M — 1
I0(3.4)
I0 3.4
,
1 —
2n 2
wher
e
h(n) = hd × wk (n) =
1
[sinωc n] ×
πn I0(3.4)
224
'
ωc = ωc +
∆ω
= 0.25π +
2
0.02π
= 0.26π
2
s
October 25, 115 /
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
FIR Filter Design FIR Filter Design Using Kaiser
Window
A/D Filter D/A
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:
x(t)
x(n) y(n) y(t)
A = —20logδs = 40 dB
logδs = —2 ⇒ δs = 0.01
20log (1 + δp ) = 0.01
∆ω =
Ω
∆ 1000π
f
=
10 × 103
= 0.1π rad
0.1π
log (1 + δp ) = 0.0005 ∆f = = 0.05
2π
δp = 0.00115 A — 7.95 58.8 —
7.95
M ≥
October 25, 116 /
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
FIR Filter Design FIR Filter Design Using Kaiser
Window
= 70.82 ' 71
δmin(δp, δs ) = 0.00115
A = —20log (0.00115) = 58.8 dB
14.36∆f
τ =
14.36 × 0.05
71 — 1
= 35
2
h
I
7
1
2
π
∫
FIR Filter Design FIR Filter Design Using Kaiser
Window
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter October 25, 117 /
The attenuation is 58.8 dB then the parameter α
is
α = 0.1102(A — 8.7)
Hd (ejω
) =
1 for |ω| ≤ ωc
0 for ωc ≤ |ω| ≤ π
= 0.1102(58.8 — 8.7) '
5.5
I0 5.5
,
1 —
2n 2
The inverse transform of the
Hd (ejω
) is
∫
1 ωc
=
ejωn
dω
1
2π
−ωc
ωc = Ωc × T = 2400π ×
10 × 103
1 ejωn ωc
= 0.24π 2π jn −ωc
' ∆ω
ω c = ωc +
2
=
1
ejωc n
— e−jωc n
2jπn
=
wk (n)
hd (n) Hd
j
)
j
d
I0 5.48
,
1 —
FIR Filter Design FIR Filter Design Using Kaiser
Window
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter October 25, 118 /
1 ejωc n — e−jωc n
= 0.24π + 0.1π
= 0.29π
2
πn 2j
=
sinωc n
πn
h(n) = hd × wk (n) =
1
π(n — τ )
[sinωc (n — τ )] ×
2n 2
224
I0(5.5)
=
h
)
25 π
∫
FIR Filter Design FIR Filter Design Using Kaiser
Window
Dr. Manjunatha. P (JNNCE) 119 /
October 25,
UNIT - 7: FIR Filter
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:
Hd (ejω
) =
1 for |ω| ≤ ωc
0 for ωc ≤ |ω| ≤ π
The inverse transform of the Hd (ejω
)
is
∆ω = ωs — ωp = 10rad/sec
1
1
∫
π jω jωn
ωc = (ωp + ωs ) = 25rad/sec
2
1 ωc
=
ejωn
dω −0.05A
100 2
−0.05×44 −3
2π −ωc δs = 10 s
= 10 = 6.3096 × 10
1 ejωn ωc δp = 100.05Ap — 1 = 100.05×0.1 —
1
= 5.7563×10−3
2π jn −ωc 100.05Ap + 1 100.05×0.1 + 1
=
1
ejωc n
— e−jωc n 2jπn
sinωc n
hd (n)
2
−
Hd
=
d
FIR Filter Design FIR Filter Design Using Kaiser
Window
Dr. Manjunatha. P (JNNCE) 120 /
October 25,
UNIT - 7: FIR Filter
δ = min(δp, δs ) = 5.7563 × 10−3 A = —20log10(δ) = 44.797dB
=
πn
M
I0 3.9524
,
1 —
FIR Filter Design FIR Filter Design Using Kaiser
Window
121 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
α = 0.5842(A — 21)0.4
+ 0.07886(A — 21)
= 0.5842(44.797 — 21)0.4
+ 0.07886(44.797 — 21)
= 3.9524
∆f =
∆ω
ωsf
10
=
10
0
= 0.1
A — 7.95
M ≥ ≥
14.36∆f
44.797 —
7.95
14.36 × 0.1
27 — 1
≥ 25.66 ' 27
τ = = 13
2
2
#
I0
"
α
r
1 —
2n
wk (n) =
wk (n) =
0 ≤ n ≤ M — 1
I0(α)
2n 2
27
0 ≤ n ≤ M — 1
I0(3.9524)
FIR Filter Design FIR Filter Design Using Kaiser
Window
122 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
I0 3.9524
,
1 —
2n 2
h(n) = hd × wk (n) = 1
[sinωc n] ×
πn
27
I0(3.9524)
UNIT - 7: FIR Filter 123 /
October 25,
Dr. Manjunatha. P (JNNCE)
FIR Filter Design FIR Filter Design Using Kaiser
Window
d
∫
h
∫
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 αp ≤ 0.1dB Stopband ripple αs ≥ 40dB
Sampling frequency F =
10000Hz Solution:
H (ejω
) =
0 for |ω| ≤ ωc
1 for ωc ≤ |ω| ≤ π
The inverse transform of the Hd (ejω
)
is
∆ω = ωp — ωs = 3200π rad/sec
1
hd (n) =
1 −ωc
2π ejωn
π
dω + ejωn
dω
ωc = (ωp + ωs ) = 4800π rad/sec
2
4800
−π
1
"
ejωn
−ωc
ωc
ejωn π
#
ωc (discrete, radian) =
2000
0
(2π) = 0.48πrad
=
1
e−jωc n
— e−jπn
+ ejπn
— ejωc n
2jπn
=
sinπn — sinωc n 100.05Ap −1
100.05×0.1−1
πn ωp = 2πfp = 6400π rad/sec
= +
δs = 10
−0.05As
= 10
−0.05×40
=
2 j
−
j
ω
UNIT - 7: FIR Filter 124 /
October 25,
Dr. Manjunatha. P (JNNCE)
FIR Filter Design FIR Filter Design Using Kaiser
Window
ωs = 2πfs = 3200π rad/sec
ωsf = 2πF = 20000π rad/sec
δp =
100.05Ap +1
=
100.05×0.1+1
= 0.005756
δ = min(δp, δs ) = 5.756 × 10−3
A = —20log10(δ) = 44.797dB
UNIT - 7: FIR Filter 125 /
October 25,
Dr. Manjunatha. P (JNNCE)
FIR Filter Design FIR Filter Design Using Kaiser
Window
FIR Filter Design FIR Filter Design Using Kaiser
Window
October 25, 126 /
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
M
I0 3.9524
,
1 —
α = 0.5842(A — 21)0.4
+ 0.07886(A — 21)
= 0.5842(44.797 — 21)0.4
+ 0.07886(44.797 — 21)
= 3.9524
∆f =
∆ω
ωsf
3200π
=
2000
0π
= 0.16
A — 7.95
M ≥ ≥
14.36∆f
44.797 —
7.95
14.36 × 0.16
17 — 1
≥ 16.03 ' 17
τ = = 8
2
2
#
I0
"
α
r
1 —
2n
wk (n) =
wk (n) =
0 ≤ n ≤ M — 1
I0(α)
2n 2
17
0 ≤ n ≤ M — 1
I0(3.9524)
FIR Filter Design FIR Filter Design Using Kaiser
Window
October 25, 127 /
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
I0 3.9524
,
1 —
2n 2
h(n) = hd × wk (n) = sinπn — sinωc n
×
πn
27
I0(3.9524)
Design of FIR system Frequency Sampling for FIR
Filters
Dr. Manjunatha. P (JNNCE) October 25, 128 /
UNIT - 7: FIR Filter
Design of FIR filter using Frequency Sampling
With necessary mathematical analysis explain the frequency sampling
technique of FIR filter design
Design of FIR system Frequency Sampling for FIR
Filters
M
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE) 129 /
| H () |k
d
  2 k  2k
M 17
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
4 8 
17 17 2
 ()
 203
17 2
30 2
17
    16k
  16 (k 17)
k
k
8 k
17
17
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 =
M
k k = 0, 1, . . . M — 1
The discrete time Fourier transform
(DTFT) is
H(k) = Hd (ω)|ω=ωk
K=0

= Hd
2π
k k = 0, 1, . . . M — 1

The inverse M point DFT (IDFT) h(n) is
M−1
Magnitude frequency response is
symmetric about π, while ideal
phase response is antisymmetric
about π
1 Σ
h(n) = H(k)ejωn
Design of FIR system Frequency Sampling for FIR
Filters
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
M
130 /
M
n=0
M−1
=
1 Σ
H(k)ej
2πkn
n = 0, 1, . . . M — 1
M
n=0
Design of FIR system Frequency Sampling for FIR
Filters
Dr. Manjunatha. P (JNNCE) 131 /
October 25,
UNIT - 7: FIR Filter
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)ej2πn(M−k)/M
H(M — k)ej2πn(M−k)/M
= H(M — k)ej2πn
e−j2πkn/M
H(M — k)ej2πn(M−k)/M
= H(M — k)e−j2πkn/M
∵ ej2πn
= cos(2πn) + jsin(2πn) = 1
substituting the |H(M — k)| = |H(k)|
H(M — k)ej2πn(M−k)/M
= H(k)e−j2πkn/M
The term H(k)e−j2πkn/M
is complex conjugate of H(k)ej2πkn/M
.
Hence H(M — k)ej2πn(M−k)/M
is complex conjugate of H(k)e−j2πkn/M
H(M — k) = H∗
(k)
Σ
Σ
2
M
— 1 if M is
P
Design of FIR system Frequency Sampling for FIR
Filters
132 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
If H(M — k) = H ∗ (k) then h(n)
h(n) =
1
M
H(0) + 2
Re
k=1
h
H(k)ej2πkn/M
i
!
where P is
M−1 if M is odd
This equation is used to compute the coefficients of FIR
filter. H(z) is
M−1
H(z ) = h(n)z −n
n=0
M−1
H(ω) = h(n)e−jωn
n=0
, Σ
P
2
,
e−j 8
0 ≤ 2πk
π
2
0
2
≤ ω
Design of FIR system Frequency Sampling for FIR
Filters
133 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
| H () |
d
  2 k  2 k
k
M17
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
4 8 
17 17 2
 ()
 203
172
30
17
2
     16k
  16 (k 17)
k
k
8 k
17
17
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
,
e
−jω,
M−1
0 ≤ ω ≤ π
Hd (ω) =
0
π 2 K=0
2
≤ ω ≤ π
e
−j8ω
0 ≤ ω ≤
π 
To sample put ω = 2πk
= 2πk

M 17
Hd (ω) =
2πk
17
17 2
0
π
≤ 2πk
≤ π
2 17
The range of k is
2πk
=
π k = 17
' 4
17 2 4
2
Hd (ω)
H (ω)
e 17 0 ≤ k 4
1 2
0
17
≤ k ≤
Design of FIR system Frequency Sampling for FIR
Filters
134 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
,
−j 16πk
17
2πk
= π k = 17
' 8
4 2
d
.
Σ
,
,

,
4
4
1
1
√

h
Design of FIR system Frequency Sampling for FIR
Filters
135 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
The value of h(n)is given by
The range of k is 0 ≤ k ≤ 17
h(n) =
1
H(0) + 2
M
,
Σ
M−1
2
Re
k=1
h
h
H(k)ej2πkn/M
i
!
i
,
.
Hence the range is 0 ≤ k ≤ 4
Similarly 17
≤ k ≤ 17
= 4.25 ≤ k ≤ 8.5
17
k=1
4 2
The range 5 ≤ k ≤ 8
|H(k)| = 1 0 ≤ k ≤ 4
|H(k)| =
1 0 ≤ k ≤ 4
0 5 ≤ k ≤ 8
,
1 13 ≤ k ≤
16
h(n) =
1
1 + 2
17
Re
e
k=1
16πk
17
e
j2πkn/17
i
!
1
= 1 +
2
17
Re
k=1
h
ej2πk(n−8)/17
i
!
8
−
k is an
R H(k)ej2πkn/
,
Σ
Σ
4
4
,
1
Design of FIR system Frequency Sampling for FIR
Filters
136 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
1
= 1 +
2
17
Σ
k=1
cos
2πk(n — 8)
!
Design of FIR system Frequency Sampling for FIR
Filters
Dr. Manjunatha. P (JNNCE) 137 /
UNIT - 7: FIR Filter October 25,
2
2
2
2
π
2
e
| H () |
d
  2 k  2 k
k
1
M7
2345 6 7
2
7
 ()
 4
2 7
6
7
 8 10 3 12
77 27
2
      6k
  6 (k  7)
k
k 3 k
7
7
Determine the impulse response h(n) of a filter having desired frequency response
H (w ) =
,
−j
,
(M−1)ω
0 ≤ |ω| ≤ π
d
0 π
≤ ω ≤ π
M=7 use frequency sampling
approach. Solution:
The Ideal LPF frequency response Hd (ω) is
H (ω) =
,
−jω
,
M−1
0 ≤ ω ≤ π K=0
d
0
π
2
2
≤ ω ≤ π

e−j3ω
0 ≤ ω ≤ π
0 2
≤ ω ≤ π
To sample put ω = 2πk
= 2πk 
M
,
−j 2πk
3
7
2πk π
H (ω) =
e
7 0 ≤ 7
≤ 2
d
0
π
≤ 2πk
≤ π
2 7
The range of k is
Hd (ω)
e
Design of FIR system Frequency Sampling for FIR
Filters
Dr. Manjunatha. P (JNNCE) 138 /
UNIT - 7: FIR Filter October 25,
7
4 7 2 4
0 7
≤ k
2πk
= π k = 7
,
e−j 6πk
0 ≤ k ≤
7
2πk
=
π k = 7
' 1
4 2 7 2
H (ω)
d
Design of FIR system Frequency Sampling for FIR
Filters
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter October 25, 139 /
4
. Σ
,
,
7
, 1
√

7
The value of h(n)is given by
The range of k is 0 ≤ k ≤ 7
k is an integer.
Hence the range is 0 ≤ k ≤ 1
Similarly 7
≤ k ≤ 7
= 1.75 ≤ k ≤ 3.5
h(n) =
1
H(0) + 2
M
M−1
2
k=1
Re
h H(k)ej2πkn/M
i
,
.
4 2 ,
Σ h i
!
The range 2 ≤ k ≤ 3
,
 1 0 ≤ k ≤ 1
1
= 1 + 2
7
Re
k=1
H(k)e j2πkn/7
|H(k)| = 0 2 ≤ k ≤
3
,
1 k = 6 |H(k)| = 1 0 ≤ k ≤ 1
h(n) = 1
1 +
2
7
1
,
Re
k=1
Σ
h
e−j
h
6πk
j2πkn/7
i
!
i
!
= 1 + 2
7
1
= 1 + 2
7
k=1
Σ
k=1
Re
cos
ej2πk(n−3)/7
2πk(n — 3)
!
3
1
Σ
n h(n) n h(n)
0 -0.1146 4 321
1 0.0793 5 0.0793
2 0.321 6 -0.1146
3 0.4283
1
Design of FIR system Frequency Sampling for FIR
Filters
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter October 25, 140 /
0
2
Determine the filter coefficients h(n) obtained by frequency sampling Hd (w ) given by
(
e
−j3ω
0 ≤ |ω| ≤ π
2
≤ ω ≤ π
Also obtain the frequency response H(w ). Take N=7. DEC 2011
Hd (w
Design of FIR system Frequency Sampling for FIR
Filters
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE) October 25, 141 /
1 0 k = 4, 5,
1
1
k
M
    14k
  14 (k 
15)
k
k 7 k
15
15
Proakis Exercise 8.6
Determine the filter coefficients h(n) of a linear phase FIR of length M=15 which has
symmetric unit impulse response and the frequency response that satisfies the
coefficients.
H
2π
k =
1 k = 0, 1, 2, 3
Solution:
|H(k)| =
1 0 ≤ k ≤ 3
0 4 ≤ k ≤ 11
,
1 12 ≤ k ≤
14
K=0



,

| Hd () |
1 2
4
3 4
6

 
2 k

5 6 7 8

2 k
15
9
1
8
10 11 12
3
13 14 15
28
2
15 15 2 15 2 15
— 14
πk 0 ≤ k ≤ 7  ()
θ
(k) 14π — 15
πk = — 15
π(k — 15) 8 ≤ k ≤

.
Σ
,
,
1
e 15
=
1
Design of FIR system Frequency Sampling for FIR
Filters
142 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
The value of h(n)is given by
h(n) =
1
√
M

1
,
H(0) + 2
Σ
M−1
2
Re
k=1
h
h
H(k)ej2πkn/M
i
!
i
,
.
|H(k)| = 1 0 ≤ k ≤ 3
1
,
Σ
h
17πk
i
!
1
= 1 + 2
15
7
3
1 H
h(n)
k
R
n h(n) n h(n)
0 -0.05 8 0.3188
1 0.041 9 0.034
2 0.066 10 -0.108
3 -0.036 11 -0.036
4 -0.108 12 0.066
5 0.034 13 0.041
6 0.3188 14 -0.05
7 0.466
k
R
7
3
,
3
1
Design of FIR system Frequency Sampling for FIR
Filters
143 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
Re
k=1
h
ej2πk(n−7)/15
i
!
1
= 1 + 2
15
Σ
k=1
cos
2πk(n — 7)
!
Σ
,

Design of FIR system Frequency Sampling for FIR
Filters
144 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
| Hd () |
1 2
k
15
4
15
2
     14k
  14 (k 15)
k
k 7 k
15
15
Proakis Exercise 8.7
Determine the filter coefficients h(n) of a linear phase FIR of length M=15 which has
symmetric unit impulse response and the frequency response that satisfies the
coefficients.
Solution:
|H(k)| =

2π
H k =
15
0.4 k = 4
0 5 ≤ k ≤ 10
1 k = 0, 1, 2, 3
0.4 k = 4
,
0 k = 5, 6,
7
K=0
θ(k) =
,

1 0 ≤ k ≤ 3

, 0.4 k = 11
3 4
0.4
6 
15 2
 
2 k

M
5 6 7 8

2 k
15
9
1
8
15
10 11 12
0.4
3
2
13 14
2
8
15
 ()
— 14
πk 0 ≤ k ≤ 7
Design of FIR system Frequency Sampling for FIR
Filters
145 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
1 12
≤ k
≤ 14


15
— 14
π(k — 15) 8 ≤ k ≤ 14
15
.
Σ
,
−
,
, 3
h
=
1
k
Design of FIR system Frequency Sampling for FIR
Filters
146 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
The value of h(n)is given by
h(n) =
1
√
M

1
,
H(0) + 2
Σ
M−1
2
Re
k=1
h
h
H(k)ej2πkn/M
i
!
i
,
.
|H(k)| = 1 0 ≤ k ≤ 3
|H(k)| = 0.4 k = 4&11
1
h(n) =
71
5
,
1 +
2
Re
k=1
17πk
e 15
e
j2πkn/15
i
!
1
= 1 + 2
15 Re
k=1
h
ej2πk(n−7)/15
i
+ 2Re
h
0.4ej2π4(n−7)/15
i
!
1 = 1 15
7
1 H
Σ
Σ
n h(n) n h(n)
0 -0.0143 8 0.313
1 -0.002 9 -0.0181
2 0.04 10 -0.091
3 0.0122 11 0.0122
4 -0.091 12 0.04
5 -0.0181 13 -0.002
6 0.313 14 -0.0143
7 0.520
R
3
3
1
Design of FIR system Frequency Sampling for FIR
Filters
147 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
Σ
k=1
cos
2πk(n
—
7
)
1
5
+ 0.8cos
8π(n —
7)
!
148 /
October 25,
UNIT - 7: FIR Filter
Dr. Manjunatha. P (JNNCE)
References
J. G. Proakis and D. G. Monalakis, Digital signal processing Principles Algorithms &
Applications, 4th ed. Pearson education, 2007.
Oppenheim and Schaffer, Discrete Time Signal Processing. Pearson education,
Prentice Hall, 2003.
S. K. Mitra, Digital Signal Processing. Tata Mc-Graw Hill, 2004.
L. Tan, Digital Signal Processing. Elsivier publications, 2007.

dsp module 4 pptpptrpppptxppppppppp.docx

  • 1.
  • 2.
    UNIT - 7:FIR Filter 2 / Unit 7: FIR Filter Design: 1 2 3 4 5 PART-B-Unit 7: FIR Filter Design: Introduction to FIR Filters Design of FIR Filters using Rectangular window Hamming
  • 3.
    UNIT - 7:FIR Filter 3 / window Hanning window Bartlet window Kaiser window Design of FIR Filter using frequency sampling technique.
  • 4.
    Advantages of theFIR digital filter Relatively easy to design and computationally more efficient. FIR filters are implemented in hardware or software. The phase response is linear. Linear phase property implies that the phase is a linear function of the frequency. FIR filter output is delayed by the same amount of time for all frequencies, thereby eliminating the phase distortion (Group delay). FIR filters are always stable i.e. for a finite input, the output is always finite. In linear phase, for the filter of length N the number of operations are of the order of N/2. Disadvantages of the FIR digital filter (compared to IIR filters) They require more memory and/or calculation to achieve a given filter response characteristic. Also, certain responses are not practical to implement with FIR filters. For a desired frequency response, with tight constraints on the passband, transition band and the stopband, a FIR filter may have large number of coefficients, thereby have more arithmetic operations and hardware components.
  • 5.
    An LTI systemis causal iff Input/output relationship: y [n] depends only on current and past input signal values. Impulse response: h[n] = 0 for n < 0 System function: number of finite zeros ≤ number of finite poles.
  • 6.
    ∫ ∫ 1 |ω| ≤ c FIRFilter Design H (e j ) d 1 An ideal lowpass filter is given by H(ω) = 0 ωc < |ω| ≤ π  c 0    The impulse response is given by Figure 1: Ideal low pass filter 1 h(n) = ωc H(ω)ejωn dω = ωc π sin(ω n) n = 0 2π −ωc ωc c π ωc n n /= 0 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 ,
  • 7.
    FIR Filter Design 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.
  • 8.
    2 Magnitude Characteristic ofFIR filter δ1 Passband ‐‐ ripple δ2 Stopband ripple ‐‐ ωp Passband ‐‐ edge fre The magnitude response can be expressed as Magnitude = 1 − δ1 ≤ |H(ω)|1 + δ1 for 0 ≤ ω ≤ ωp 0 ≤ |H(ω)δ2 for ωs ≤ ω ≤ π Approximate formula for order N is N = −10log10(δ1δ2) − 15 14∆f where ∆f = ωs −ωp = fs − fp Approximate formula for order N is 2π N = k ωs − ωp
  • 9.
    M The width ofthe main lobe is N = k 2π Figure 3: Magnitude Specification of FIR
  • 10.
    FIR Filter Design Idealfilters 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.
  • 11.
    FIR Filter Design Themagnitude 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
  • 12.
    FIR Filter DesignFIR Filter Design UNIT - 7: FIR Filter 12 / FIR Filter Design
  • 13.
    Σ Σ Σ FIR Filter DesignFIR Filter Design UNIT - 7: FIR Filter October 25, 13 / An FIR system does not have feedback. Hence y (n − k) term is absent in the system. FIR output is expressed as If there are M coefficients then M y (n) = bk x (n − k) k=0 M−1 y (n) = bk x (n − k) k=0 The coefficients are related to unit sample response as h(n) = bn for 0 ≤ n ≤ M − 1 0 otherwise Expanding the summation y (n) = b0x (n) + b1x (n − 1) + b2x (n − 2) + . . . b(M−1)x (n − M + 1) Since h(n) = bn then y(n) is M−1
  • 14.
    FIR Filter DesignFIR Filter Design UNIT - 7: FIR Filter October 25, 14 / y (n) = h(k)x (n − k) k=0
  • 15.
    UNIT - 7:FIR Filter October 25, 15 / Symmetric and Antisymmetric FIR Filters Linear Phase FIR 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 The Z transform of the unit sample response is given as
  • 16.
    Σ UNIT - 7:FIR Filter October 25, 16 / M−1 H(z ) = h(n)z −n n=0
  • 17.
    FIR Filter DesignSymmetric and Antisymmetric FIR Filters UNIT - 7: FIR Filter October 25, 17 / 0 1 2 3 4 5 6 7 8n Center of Symmetry 0 1 2 3 4 5 6 7 8n 0 1 2 3 4 5 6 7 8n Center of Symmetry Symmetry: h(n)=h(M-1-n) Odd M Symmetry: h(n)=h(M-1-n) Even M h[n] h[n] 0 1 2 3 4 5 6 7 8 n Center of Symmetry Antisymmetry: h(n)=-h(M-1-n) Odd M Antisymmetry: h(n)=-h(M-1-n) Even M h[n] h[n] Center of Symmetry Figure 4: Symmetric and antisymmetric responses
  • 18.
    FIR Filter DesignSymmetric and Antisymmetric FIR Filters UNIT - 7: FIR Filter October 25, 18 / The unit sample response of FIR filter is symmetric if h(n) = h(M − 1 − n) The unit sample response of FIR filter is antisymmetric if h(n) = −h(M − 1 − n)
  • 19.
    Σ Σ 2 Σ 2 2 e2 .e FIR Filter Design Symmetric and Antisymmetric FIR Filters UNIT - 7: FIR Filter October 25, 19 / 2 2 0 1 2 3 4 5 6 7 8n Center of Symmetry Frequency response of Linear Phase FIR Filter: Symmetric with M=odd M−1 H(z ) = h(n)z −n n=0 Symmetry: h(n)=h(M-1-n) Odd M h[n] Symmetric impulse response with M=odd Then h(n) = h(M − 1 − n) and (z = ejω ) H(z ) = h M − 1 , M−1 (M−3)/2 + n=0 h(n) h z −n + z −(M−1−n) i H(ejω ) = h M − 1 −jω , M−1 M−3 2 n=0 h(n) h e−jωn + e−jω(M−1−n) i −jωn −jωn jω( M−1 ) −jω( M−1 ) jω( M−1 −n) −jω( M−1 ) e = e e 2 e 2 = e 2 .e 2 e−jω(M−1−n) = e −jω(M−1) ejωn = e −jω( M−1 ) .e −jω( M−1 ) jωn −jω( M−1 ) −jω( M−1 −n) -2 -1 0 1 2 3 e + z 2
  • 20.
    2 2 e 22 , FIR Filter Design Symmetric and Antisymmetric FIR Filters UNIT - 7: FIR Filter October 25, 20 / −jωn −jω(M−1−n) −jω , M−1 jω , M−1 −n −jω , M−1 −n −jω M−1 = e 2cosω M − 1 — n 2 e + = +
  • 21.
    2 Σ 2 2 Σ 2 Σ  2 Σ ∠H(ω) =  −ω+ π for |H(ω)| < 0 FIR Filter Design Symmetric and Antisymmetric FIR Filters 21 / October 25, UNIT - 7: FIR Filter H(ejω ) = h( M − 1 2 )e−jω( M−1 ) + M−3 2 n=0 h(n)[e−jωn + e−jω(M−1−n) ] = h M − 1 −jω , M−1 M−3 2 n=0 h(n)e −jω , M−1 2cosω M − 1 — n 2 = e −jω , M−1 2  h M − 1 2 M−3 2 + 2 n=0 h(n)cos ω M − 1 2 — n   H(ω) = |H(ω)|ej∠H(ω) |H(ω)| = h M − 1 + 2 M−3 2 n=0 h(n)cos ω M − 1 — n 2  e +
  • 22.
      −ω for|H(ω)| > 0 FIR Filter Design Symmetric and Antisymmetric FIR Filters 22 / October 25, UNIT - 7: FIR Filter M−1 2 M−1 2
  • 23.
     2  Σ 2   −ω for|H(ω)| > 0 ∠H(ω) =  −ω + π for |H(ω)| < 0 FIR Filter Design Symmetric and Antisymmetric FIR Filters October 25, 23 / UNIT - 7: FIR Filter Frequency response of Linear Phase FIR Filter: Symmetric with M=Even H(ω) = e −jω , M−1 2   2 M −1 n=0 h(n)cos ω M − 1 2 — n   Symmetry: h(n)=h(M-1-n) Even M h[n] H(ω) = |H(ω)|ej∠H(ω) |H(ω)| = 2 M −1 n=0 h(n)cos ω M − 1 — n 2 0 1 2 3 4 5 6 7 8 n Center of Symmetry M−1 2 M−1 2 -2 -1 0 1 2 3 Σ
  • 24.
    FIR Filter DesignDesign of linear-phase FIR filters using windows 24 / October 25, UNIT - 7: FIR Filter Design of linear-phase FIR filters using windows
  • 25.
    Σ ∫ FIR Filter Design UNIT -7: FIR Filter 25 / October 25, 1 2 3 Design steps for Linear Phase FIR Filter (Fourier Series method) Based on the desired frequency response specification Hd (ejω ) determine the corresponding unit sample response hd (n). ∞ Hd (ejω ) = hd (n)e−jωn n=0 Obtain the impulse response hd (n) for the desired frequency response Hd (ω) by evaluating the inverse Fourier transform. 1 π hd (n) = −π Hd (ejω )ejωn dω 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. where w (n) is window function h(n) = hd (n)w (n) 2
  • 26.
    FIR Filter Design UNIT -7: FIR Filter 26 / October 25, 4 5 Obtain the H(z ) for h(n) by taking z transform Obtain the magnitude response |H(ejω )| and phase response θ(ω)|
  • 27.
    FIR Filter Design UNIT -7: FIR Filter 27 / October 25, 1 0p  1 0p  1 1 0 1 2 3 4  Low-pass filter is used to eliminate high-frequency fluctuations (eg. noise filtering, demodulation, etc.) High-pass filter is used to follow small-amplitude high-frequency perturbations in presence of much larger slowly-varying component (e.g. recording the electrocardiogram in the presence of a strong breathing signal) Band-pass is used to select a required modulated carrier signal (e.g. radio) Band-stop filter is used to eliminate single-frequency (e.g. mains) interference (also known as notch filtering) Hd () Hd () Low pass Filter Hd ()  Hd ()  High pass Filter 0 1 2   
  • 28.
    FIR Filter Design UNIT -7: FIR Filter 28 / October 25, Band pass Filter Band stop pass Filter Figure 5: Frequency response characteristic of different types of filters
  • 29.
    FIR Filter Design UNIT -7: FIR Filter 29 / October 25, Different Types of Windows Rectangular: Hanning Hamming: Blackman: Bartlett (Triangular) Window Kaiser window
  • 30.
    R 2 30 / October 25, UNIT- 7: FIR Filter Rectangular window wR (n) This is the simplest window function but provides the worst performance from the viewpoint of stopband attenuation. The width of main lobe is 4π/N ω (n) = 1 for n = 0, 1, M − 1 0 otherwise Magnitude response of rectangular window is n 0 1 2 3 4 5 6 M-1 Figure 6: Rectangular window | sin( ωM )| |WR (ω)| = 2 | sin( ω )|
  • 31.
    31 / October 25, UNIT- 7: FIR Filter Figure 7: Rectangular window
  • 32.
    32 / October 25, UNIT- 7: FIR Filter Bartlett (Triangular) Window 0 1 2 3 4 5 6 M-1 wT (n) n Figure 8: Bartlett window Bartlett Window is also Triangular window. The width of main lobe is 8π/M 2|n − M−1 | ωT (n) = 1 − 2 M − 1
  • 33.
    33 / October 25, UNIT- 7: FIR Filter Figure 9: Bartlett window
  • 34.
    M UNIT - 7:FIR Filter October 25, 34 / Hanning window n 0 1 2 3 4 5 6 M-1 This is a raised cosine window function given by: w (n) = 1 1 − cos 2πn W (ω) ≈ 0.5WR 2 (ω) + 0.25 WR M − 1 2π (ω − ) + WR M (ω + 2π ) M The width of main lobe is: 8π wH (n)
  • 35.
    UNIT - 7:FIR Filter October 25, 35 / Figure 10: Hanning window Figure 11: Hanning window
  • 36.
    M − M UNIT -7: FIR Filter October 25, 36 / Hamming window 0 1 2 3 4 5 6 M-1 This is a modified version of the raised cosine window w (n) = 0.54 − 0.46 cos 2πn W (ω) ≈ 0.54WR The width of main lobe is: 8π (ω) + 0.23 WR 2π (ω − ) + WR M (ω + 2π ) M wH (n) n
  • 37.
    UNIT - 7:FIR Filter October 25, 37 / Figure 12: Hamming window Figure 13: Hamming window
  • 38.
    M M M − M− +0.04 W (ω + 4π ) M M UNIT - 7: FIR Filter October 25, 38 / Blackman window This is a 2nd -order raised cosine window. w (n) = 0.42 − 0.5 cos 2πn + 0.08 cos 4πn W (ω) ≈ 0.42WR (ω) + 0.25 WR (ω − 2π ) + WR (ω + 2π ) The width of main lobe is: 12π wT (n) R (ω − 4π ) + R M
  • 39.
    UNIT - 7:FIR Filter October 25, 39 / n 0 1 2 3 4 5 6 M-1 Figure 14: Blackma n window 15: Blackma n window
  • 40.
    M Figure 16: Kaiserw 17: Kaiser UNIT - 7: FIR Filter October 25, 40 / Kaiser window n 0 1 2 3 4 5 6 M-1 This is one of the most useful and optimum windows. w (n) = I0 , β r 1 − 1 − 2n 2 ! I0(β) Where I0(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)
  • 41.
    FIR Filter DesignWindow Design Techniques Window name Transition width of main lobe Min. stopband attenuation Peak value of side lobe Rectangular 4π M+1 - 21 dB -21 dB Hanning 8π M - 44 dB -31 dB Table 1: Window and its functions Window name Window Function Rectangular ωR (n) = 1 for 0 ≤ n ≤ M − 1 0 otherwise Triangular (Bartlet) 2|n− M−1 | ωT (n) = 1 − M− 2 1 h i Hamming w (n) = 0.54 − 0.46 cos 2πn N−1 h i Hanning w (n) = 0.5 − 0.5 cos 2πn N−1 h i Blackman w (n) = 0.42 − 0.5 cos 2πn + 0.08 cos 4πn N−1 N−1 Table 2: Summary of window function characteristics
  • 42.
    FIR Filter DesignWindow Design Techniques 26 / October 25, UNIT - 7: FIR Filter 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 .
  • 43.
    FIR Filter DesignWindow Design Techniques 27 / October 25, UNIT - 7: FIR Filter Figure 18: LPF designed with rectangular window M=61 and 101 Figure 19: LPF designed with Hamming, Hanning and Blackman window M=61
  • 44.
    2 d 0 1 2 π FIR Filter DesignLow Pass FIR Filter Design UNIT - 7: FIR Filter October 25, 28 / 1 H (e j ) d Design a LPF using rectangular window for the desired frequency response of a low pass filter given by ωc = π rad/sec, and take M=11. Find the values of h(n). Also plot the magnitude response . Solution: jω   e−jωτ − ωc ≤ ω ≤ ωc Hd (e ) = 0 − π ≤ ω ≤ −ωc  0 ωc ≤ ω ≤ π M − 1 τ = = 5 2    0 2    2 H (ejω ) = e−jωτ − ωc ≤ ω ≤ ωc Figure 20: Frequency response of LPF By taking inverse Fourier transform ∫ hd (n) Hd j ) j d
  • 45.
    ∫ h ∫ FIR FilterDesign Low Pass FIR Filter Design UNIT - 7: FIR Filter October 25, 29 / 1 " ejω(n−τ ) #ωc 1 ωc = 2π −ωc e−jωτ ejωn dω = 1 ejωc (n−τ ) − e−jωc (n−τ ) 2jπ(n − τ ) 1 ωc = ejω(n−τ ) dω 1 " ejωc (n−τ ) − e−jωc (n−τ ) # 2π −ωc π(n − τ ) 2j hd (n) = 2 j (n − −
  • 46.
    2 0 FIR Filter DesignLow Pass FIR Filter Design October 25, 30 / UNIT - 7: FIR Filter h (n) = sin [ωc (n − τ )] π(2−5) d π(n − τ ) for n /= 5 and ωc = π , τ = M−1 = 5 sin hd (2) = 2 π(2 − 5) π(3−5) = −0.106 2 2 hd (3) = sin 2 = 0 h (n) = sin [ωc (n − 5)] = sin h π(n−5) i π(3 − 5) sin π(4−5) d π(n − 5) π(n − 5) hd (4) = 2 = .318 π(4 − 5) for n=5 hd (n) = 0 . Using L Hospital’s Rule sin Bθ lim = B hd (5) = sin π(5−5) 2 = .5 π(5 − 5) sin π(6−5) θ→0 θ hd (6) = 2 = .318 π(6 − 5) sin π (n − 5) lim 2 = π/2 = 0.5 hd (7) = sin π(7−5) 2 = 0.0 n→5 π(n − 5) π π(7 − 5) where π = 3.1416 hd (0) = sin π(0−5) 2 = 0.0637 π(0 − 5) hd (8) =
  • 47.
    FIR Filter DesignLow Pass FIR Filter Design October 25, 31 / UNIT - 7: FIR Filter hd (9) = sin π(8−5) 2 = −.106 π(8 − 5) sin π(9−5) 2 = 0 sin π(1−5) π(9 − 5) π(10−5) hd (1) = 2 = 0 π(1 − 5) hd (10) = sin 2 = .063 π(10 − 5)
  • 48.
    Σ Σ Σ FIR Filter DesignLow Pass FIR Filter Design 32 / October 25, UNIT - 7: FIR Filter The given window is rectangular window ω(n) = 1 for 0 ≤ n ≤ 10 0 Otherwise This is rectangular window of length M=11. h(n) = hd (n)ω(n) = hd (n) for 0 ≤ n ≤ 10 M−1 10 H(z ) = Σ h(n)z −n = Σ h(n)z −n n=0 n=0 The impulse response is symmetric with M=odd=11 H(z ) = h M − 1 z M−3 2 + M−3 2 n=0 h(n)[z −n + z (M−1−n) ] = h(5)z −5 + h(0)[z −0 + z −10 ] + h(1)[z −1 + z −9 ] + h(2)[z −2 + z −8 ] + = +h(3)[z −3 + z −7 ] + h(4)[z −4 + z −6 ] |H(ejω )| = h M − 1 + 2 4 M−3 2 n=0 h(n)cos ω 2 2
  • 49.
    FIR Filter DesignLow Pass FIR Filter Design 33 / October 25, UNIT - 7: FIR Filter M − 1 — n 2 = h(5) + 2 h(n)cos ω(5 − n) n=0 = h(5) + 2h(0)cos 5ω + 2h(1)cos 4ω + 2h(2)cos 3ω + 2h(3)cos 2ω + 2h(4)cos ω = 0.5 + 0.127cos 5ω − 0.212cos 3ω + 0.636cos ω
  • 50.
    FIR Filter DesignLow Pass FIR Filter Design 34 / October 25, UNIT - 7: FIR Filter |H(ejω )| = 0.5 + 0.127cos 5ω − 0.212cos 3ω + 0.636cos ω |H(ejω )|dB = 20log |H(ejω )| 10 0 10 − 20 − 30 − 40 − 50 − 60 − , 0 to  in radians Figure 21: Frequency response of LPF | 0 0.5 1 1.5 2 2.5 3 3.5 ω |H(ejω )| |H(ejω )|dB 0 1.0151 -0.44 0.1π 0.9808 -0.17 0.2π 0.9535 -0.41 0.3π 1.0758 0.63 0.4π 0.9952 -0.04 0.5π 0.5 -6.02 0.6π 0.0048 -46.37 0.7π 0.0758 -22.41 0.8π 0.0467 -26.65 0.9π 0.0192 -34.35 1.0π 0.0512 -25.74
  • 51.
    4 ∫ ) 0 4 ∫ FIR Filter DesignLow Pass FIR Filter Design 35 / October 25, UNIT - 7: FIR Filter 1 H (e j ) d   3 0 3  The desired frequency response of low pass filter is given by jω e−j3ω − 3π ≤ ω ≤ 3π π ≤ |ω| ≤ π Determine the frequency response of the FIR if Hamming window is used with N=7 June- 2015, Dec-2014, June-2012 Solution: hd (n) = 1 ∫ π Hd (ejω )ejωn dω M − 1 τ = = 3 2 2π −π 1 ωc = e−jωτ ejωn dω 2π −ωc 1 ωc = 2π −ωc ejω(n−τ )dω  4 4 1 " ejω(n−τ ) #ωc 2π j(n − τ ) −ωc sinωc (n − τ ) Hd =
  • 52.
    FIR Filter DesignLow Pass FIR Filter Design 36 / October 25, UNIT - 7: FIR Filter 1 " ejωc (n−τ ) − e−jωc (n−τ ) # hd (n) = π(n − τ ) π(n − τ ) 2j =
  • 53.
    sin sin 4 0 4 4 4 2 d FIR FilterDesign Low Pass FIR Filter Design 37 / October 25, UNIT - 7: FIR Filter π(n − n /= 3 ωc = 3π τ = M−1 = 3 hd (0) = hd (1) = 3π(0−3) 4 π(0 − 3) 3π(1−3) 4 π(1 − 3) 3π(2−3) = 0.075 = −0.159 h (n) = sin h 3π(n−3) i π(2 − 3) 3π(3−3) for n=3 hd (n) = 0 . Using L Hospital’s Rule hd (4) = π(3 − 3) sin 3π(4−3) = 0.225 lim sin 3π (n − 3) 3π/4 = = 0.75 π(4 − 3) 3π(5−3) hd (2) s = hd (3) s = n π hd (5) s = 4 π(n − 4 4
  • 54.
    sin FIR Filter DesignLow Pass FIR Filter Design 38 / October 25, UNIT - 7: FIR Filter hd (6) = π(5 − 3) 3π(6−3) 4 π(6 − 3) = 0.075
  • 55.
    6 6 FIR Filter DesignLow Pass FIR Filter Design 39 / October 25, UNIT - 7: FIR Filter The given window is Hamming window M − 1 6 4π 6 8π = 1 = 0.77 h(5) = hd (5)w (5) = −0.159 × 0.31 = −0.049 10π = .31 0.54 − 0.46cos 12π = .08 6 w (n) = ω(0) = ω(1) = ω(2) = ω(3) = 0.54 − 0.46cos ω(4) = 0.54 − 0.46cos ω(5) = 0.54 − 0.46cos ω(6) = 0.54 − 0.46cos 2πn 0.54 − 0.46cos 0 = 0.08 0.54 − 0.46cos 2π = .31 To calculate the value of h(n) h(n) = hd (n)w (n) 6 h(0) = hd (0)w (0) = 0.075 × 0.08 = 0.006 0.54 − 0.46cos = .77 6 h(1) = hd (1)w (1) = −0.159 × 0.31 = −0.049 6π h(2) = hd (2)w (2) = 0.225 × 0.77 = 0.173
  • 56.
    FIR Filter DesignLow Pass FIR Filter Design 40 / October 25, UNIT - 7: FIR Filter h(6) = hd (6)w (6) = 0.075 × 0.08 = 0.006
  • 57.
    Σ Σ FIR Filter DesignLow Pass FIR Filter Design October 25, 41 / UNIT - 7: FIR Filter The frequency response is symmetric with M=odd=7 |H(ejω )| = h M − 1 + 2 2 M−3 2 n=0 h(n)cos ω M − 1 — n 2 = h(3) + 2 h(n)cos ω(3 − n) = h(3) + 2h(0)cos 3ω + 2h(1)cos 2ω + 2h(2)cos ω n=0 = 0.75 + 0.012cos 3ω − 0.098cos 2ω + 0.346cos ω |H(ejω )|dB = 20log |H(ejω )| ω |H(ejω )| |H(ejω )|dB 0 1.0100 0.0864 0.1π 1.0068 0.0592 0.2π 0.9959 -0.0354 0.3π 1.9722 -0.2445 0.4π 0.9265 -0.6631 0.5π 0.8480 -1.4321 0.6π 0.7321 -2.7089 0.7π 0.5883 -4.6077 0.8π 0.4435 -7.0620 0.9π 0.3346 -9.5095 1.0π 0.2940 -10.6331 2
  • 58.
    FIR Filter DesignLow Pass FIR Filter Design October 25, 42 / UNIT - 7: FIR Filter 0 −2 −4 −6 −8 −10 2 12 − , 0 to  in radians Figure 22: Frequency response of LPF | 0 0.5 1 1.5 2 2.5 3 3.5
  • 59.
    FIR Filter DesignLow Pass FIR Filter Design October 25, 43 / UNIT - 7: FIR Filter Matlab code clc; clear all; close all; M= input(’enter the value of M:’); omega= input(’enter the value of omega:’); tau=(M-1)/2 ; for n=0:M-1; % c(n+1)=.5-.5*cos((2*pi*n)/(M-1)); c(n+1)=.54-.46*cos((2*pi*n)/(M-1)); if n==tau h(n+1)=omega/pi; else h(n+1)=sin(omega*(n-tau))/(pi*(n-tau)); end end h c for n=1:M y=h(n)*c(n)’ end
  • 60.
    FIR Filter DesignLow Pass FIR Filter Design 44 / October 25, UNIT - 7: FIR Filter clc; clear all; close all; range=0; %M= input(’enter the value of M:’); for omega=0:.1*pi:pi range=range+1; H_omega=abs(0.75+.012*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:pi; i=1:range; plot(omega, H_indB(i),’linewidth’,2 ) xlabel(’ omega, 0 to pi in radians’,’fontsize’,13) ylabel(’ |H(e^{jw})|_{dB}’,’fontsize’,13)
  • 61.
    ∫ ) 0 4 4 2jπ(n − e— 4 ∫ FIR Filter Design Low Pass FIR Filter Design Dr. Manjunatha. P (JNNCE) October 25, 45 / UNIT - 7: FIR Filter 1 Hd (e ) j Determine the filter coefficients hd (n) for the desired frequency response of a low pass filter given by jω e−2jω for − π ≤ ω ≤ π 4 ≤ |ω| ≤ −π If we define the new filter coefficients by hd (n) = hd (n)ω(n) where ω(n) = 1 for 0 ≤ n ≤ 4 0 otherwise Determine h(n) and also the frequency response H(ejω ) July-2013, July-2011 Solution: hd (n) = 1 ∫ π Hd (ejω )ejωn dω 2π −π 1 π/4 = 2π −π/4 e−j2ω ejωn dω    0    4 4 1 π/4 = ejω(n−2) dω 2π −π/4 1 " ejω(n−2) #π/4 1 h j π (n−2) −j π (n−2) i Hd = 2 j(n − hd (n)
  • 62.
    π(n − 4 2 4 FIR FilterDesign Low Pass FIR Filter Design Dr. Manjunatha. P (JNNCE) October 25, 46 / UNIT - 7: FIR Filter −π/4 1 " ej π (n−2) − e−j π (n−2) # =
  • 63.
    FIR Filter DesignLow Pass FIR Filter Design 47 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) n /= 2 sin π(n−2) hd (n) = 4 π(n − 2) The given window function is ω(n) = 1 for 0 ≤ n ≤ 4 0 Otherwise This is rectangular window of length M=5. for n=2 h (n) = 0 . Using L Hospital’s Rule In this case h(n) = hd (n) for 0 ≤ n ≤ 4 d 0 sin π (n − 2) π/4 lim 4 = = 0.25 n→2 π(n − 2) π n hd (n) n hd (n) 0 0.159091 3 0.224989 1 0.224989 4 0.159091 2 0.25
  • 64.
    Σ Σ FIR Filter DesignLow Pass FIR Filter Design 48 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) The frequency response is symmetric with M=odd=5 |H(ejω )| = h M − 1 + 2 1 M−3 2 n=0 h(n)cos ω M − 1 — n 2 = h(2) + 2 h (2 − n) cos ωn = h(2) + 2h(0)cos 2ω + 2h(1)cos ω n=0 = 0.25 + 0.318cos 2ω + 0.45cos ω |H(ejω )|dB = 20log |H(ejω )| ω |H(ejω )| |H(ejω )|dB 0 1.0180 0.1550 0.1π 0.9352 -0.5815 0.2π 0.7123 -2.9464 0.3π 0.4162 -7.6132 0.4π 0.1318 -17.6023 0.5π 0.0680 -23.3498 0.6π 0.1463 -16.6936 0.7π 0.1128 -18.9561 0.8π 0.0158 -36.0322 0.9π 0.0793 -22.0154 1.0π 0.1180 -18.5624 2
  • 65.
    FIR Filter DesignLow Pass FIR Filter Design 49 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) 0 −10 −20 −30 −40 −50 10 60 − , 0 to  in radians Figure 23: Frequency response of LPF | 0 0.5 1 1.5 2 2.5 3 3.5
  • 66.
    FIR Filter DesignLow Pass FIR Filter Design 50 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) 1 H (e j ) d Design the symmetric FIR lowpass filter whose desired frequency response is given as Hd (ω ) = e−jωτ 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 (ω) Length of the filter M=7 Cut-off frequency ωc = 1 radians/sample. Unit sample response is defined as  hd (n) = 1 ∫ π Hd (ejω )ejωn dω  1 0 1  2π −π
  • 67.
    FIR Filter DesignLow Pass FIR Filter Design 51 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) Given Hd (ω) is Figure 24: Frequency response of LPF Hd (ω) = e−ωτ for − 1 ≤ ω ≤ 1 0 Otherwise
  • 68.
    ∫ ∫ " # FIR FilterDesign Low Pass FIR Filter Design 52 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) hd (n) = 1 1 2π −1 e−ωτ ejωn dω Determine the value of τ M — 1 τ = = 3 1 1 = 2 ejω(n−τ ) dω 2π −1 1 eω(n−τ ) 1 = hd (n) = sin(n−3) π(n−3) 1 π for n /= τ for n = τ 2π j(n — τ ) −1 This is rectangular window of length M=7. sin(n — τ ) = π(n — τ ) for n /= τ In this case h(n) = hd (n).w (n) = hd (n) for n = τ hd (n) = 0 . Using L Hospital’s Rule lim n→τ 0 sin(n — τ ) 1 = π(n — τ ) π , n h(n) n h(n) 0 0.015 4 0.2678 1 0.1447 5 0.14472 2 0.2678 6 0.15 3 0.3183
  • 69.
    FIR Filter DesignLow Pass FIR Filter Design 53 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) Thus hd (n) is hd (n) = sin(n−τ ) π(n−τ ) 1 π for n /= τ for n = τ This is the unit sample response of required FIR filter. The filter is symmetric and satis- fies h(n) = h(M — 1 — n) ,
  • 70.
    FIR Filter DesignLow Pass FIR Filter Design October 25, 54 / UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) Design the FIR filter using Hanning window Solution:For M=7 ω(n) = 0.5(1 — cos ω(n) = 0.5(1 — cos 2πn ) M — 1 2πn ) 6 To calculate the value of h(n) h(n) = hd (n)w (n) ω(0) = 0.0 2π ω(1) = 0.5(1 — cos ) = .25 6 4π ω(2) = 0.5(1 — cos ) = .75 6 6π h(0) = hd (0)w (0) = 0.01497 × 0 = 0 h(1) = hd (1)w (1) = 0.014472 × 0.25 = 0.03618 h(2) = hd (2)w (2) = 0.26785 × 0.75 = 0.20089 h(3) = hd (3)w (3) = 0.31831 × 1 = 0.31831 ω(3) = 0.5(1 — cos ω(4) = 0.5(1 — cos ω(5) = 0.5(1 — cos ω(6) = 0.5(1 — cos ) = 1 6 8π) = .75 h(4) h(5) = = hd (4)w (4) = 0.26785 × 0.75 = 0.20089 hd (5)w (5) = 0.14472 × 0.25 = 0.03618 6 10π h(6) = hd (6)w (6) = 0.014497 × 0.0 = 0
  • 71.
    FIR Filter DesignLow Pass FIR Filter Design October 25, 55 / UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) 6 12π 6 ) = .25 ) = 0
  • 72.
    FIR Filter DesignLow Pass FIR Filter Design Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter October 25, 56 / 1 H (e j ) d Design a lowpass digital filter to be used in an A/D Hz D/A structure that will have a -3 dB cut-off at 30 π rad/sec and an attenuation of 50 dB at 45 π rad/sec. The filter is required to have linear phase and the system will use sampling rate of 100 samples/second. 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 As =50 dB for ωs = 45πrad/sec ω = Ω Fsf ω = Ω1 = 30π = 0.3π rad/sample    Fsf 100 0.3 0 0.3  ω = Ω2 = 45π = 0.45π rad/sample Figure 25: Fsf 100 Frequency response of LPF 1 2
  • 73.
    FIR Filter DesignLow Pass FIR Filter Design Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter October 25, 57 / 3 dB attenuation at ω1 = 0.3π rad/sample 50 dB attenuation at ω2 = 0.45π rad/sample
  • 74.
    M ∫ FIR Filter DesignLow Pass FIR Filter Design 58 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) Type of window is The stopband attenuation of 50 dB is provided by the Hamming window which of -53 dB. Hence Hamming win- dow is selected for the given specifica- Hd (ω) = e−jωτ for — ωc 0 Otherwise ≤ ω ≤ ωc tions. To determine the order of the filter The width of the main lobe in Ham- τ = (M — 1)/2 = 55 — 1/2 = 27 ωc = 0.3π ming window is 8π 2π 8π hd (n) = 1 ωc 2π −ωc e−jωτ ejωn dω k = M M = 1 ∫ 0.3π ejω(n−27) dω 2π −0.3π 8π M = ω2 — ω1 1 " eω(n−27) #0.3π The order of the filter M is: 2π j(n — 27) −0.3π 8π M = 0.45π — 0.3π =
  • 75.
    FIR Filter DesignLow Pass FIR Filter Design 59 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) = 53.33 = sin (n 27)] π(n — 27) when n = 27 for n /= 27 Assume linear phase FIR filter of odd length Hence select next odd integer h (n) = ωc = 0.3 d length of 55. π
  • 76.
    M FIR Filter DesignLow Pass FIR Filter Design 60 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) The selected window is Hamming M=27 2πn = 0.54 — 0.46cos πn 18 The value of h(n) h(n) = hd (n)w (n) for M= 27 h(n) = sin[0.3π(n — 27)] π(n — 27) 0.54 — 0.46cos πn i for n /= 27 h (n ) = 0.3 h w (n) = 0.54 — n h(n) n h(n) 0 0.0 28 0.2567 1 0.0 29 0.1495 2 -0.0012 30 0.0319 3 0.0 31 -0.0445 4 0.0 32 -0.0588 5 0.0021 33 - 0.0278 6 0.0023 34 0.012 7 0.0 35 0.0308 8 -0.0036 36 0.0220 9 -0.0052 37 -0.0 10 -0.0021 38 -0.0157 11 0.0048 39 -0.0156 12 0.0098 40 -0.0043 13 0.0069 41 0.0069 14 -0.0043 42 0.0098 15 -0.0156 43 0.0048 16 -0.0157 44 -0.0021 17 0.0 45 -0.0052 18 0.0220 46 -0.0036 19 -0.0308 47 0.0 20 -0.0120 48 0.0023 21 -0.0278 49 0.0021 22 -0.0588 50 0.0 23 -0.0445 51 0.0 24 0.0319 52 -0.0012 25 0.1495 53 0.0 26 0.2567 54 0.0 27 0.3 1
  • 77.
    FIR Filter DesignLow Pass FIR Filter Design 61 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) h 0.54 — 0.46cos πn i 1
  • 78.
    FIR Filter DesignLow Pass FIR Filter Design 62 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) 1 H (e j ) d 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 45 π rad/sec As =50 dB for ωs = 45πrad/sec ω = Ω Fsf ωp = Ω p Fsf 2π × 10 × 103 = 50 × 103 = 0.4π  0.5 0 0.5   ωs = Ω s Fsf 2π × (10 + 5) × 103 = 50 × 103 = 0.6π
  • 79.
    FIR Filter DesignLow Pass FIR Filter Design 63 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) Figure 2 6: Frequency response of LPF ωp = 0.4π rad/sample ωs = 0.6π rad/sample
  • 80.
    FIR Filter DesignLow Pass FIR Filter Design October 25, 64 / UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) Type of window is The stopband attenuation of 50 dB is provided by the Hamming window which of -53 dB. Hence Hamming win- Hd (ω ) = e−jωτ for — ωc ≤ ω ≤ ωc 0 Otherwise dow is selected for the given specifica- tions. τ = (M — 1)/2 = 41 — 1/2 = 20 ωc = ωp + ∆ω = 0.4π + 0.2π To determine the order of the filter The width of the main lobe in Ham- ming window is 8π ωc = 0.5π 2 2 1 ∫ ωc M 2π 8π k = hd (n) = 2π −ωc e−jωτ ejωn dω M M = 1 ∫ 0.5π ejω(n−20) dω 8π 2π −0.5π M ≥ ωs — ωp 1 " eω(n−27) #0.5π The order of the filter M is: 2π j(n — 20) −0.5π 8π M ≥ 0.6π 0.4π =
  • 81.
    FIR Filter DesignLow Pass FIR Filter Design October 25, 65 / UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) ≥ 40 = si n[ωc (n — 20)] for n /= 20 π(n — 20) Assume linear phase FIR filter of odd length Hence select next odd integer length of 41. when n = 20 hd (n) = ωc = π 0.5π = 0.5 π
  • 82.
    FIR Filter DesignLow Pass FIR Filter Design 66 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) M 2 The selected window is Hamming M=41 2πn = 0.54 — 0.46cos 2πn 40 The value of h(n) h(n) = hd (n)w (n) for M= 41 n /= 20 h(n) = sin[0.5π(n — 20)] π(n — 20) 0.54 — 0.46cos 2πn for n = 20 w (n) = 0.54 — n h(n) n h(n) 0 0.0 21 0.3148 1 -0.00146 22 0.0 2 0.0 23 -0.1 3 -0.00247 24 0.0 4 0 25 0.055 5 -0.00451 26 0.0 6 0.0 27 -0.0337 7 0.0079 28 0.0 8 0.0 29 0.0213 9 -0.0136 30 0.0 10 0.0 31 -0.0136 11 0.002135 32 0.0 12 0.0 33 0.0079 13 -0.03375 34 0 14 0.0 35 -0.0045 15 0.05504 36 0.0 16 0.0 37 0.0024 17 -0.1006 38 0.0 18 0.0 39 -0.0014 19 0.3148 40 0.0 20 0.5
  • 83.
    2 FIR Filter DesignLow Pass FIR Filter Design 67 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) h(n) = 0.5 0.54 — 0.46cos 2πn
  • 84.
    F ∫ 1 " eω(n−3) ∫ FIR Filter DesignLow Pass FIR Filter Design Dr. Manjunatha. P (JNNCE) October 25, 68 / UNIT - 7: FIR Filter 1 H (e j ) d 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: Fc = 200 Hz, Fs = 1000 Hz, fc = Fc 200 = 0.2cycles/sample s ωc = 2π ∗ fc = 2π × 0.2 = 0.4πrad M=7 Hd (ω) = e−jωτ for — ωc ≤ ω ≤ ωc 0 Otherwise  0.4 0 0.4    τ = (M — 1)/2 = 7 — 1/2 = 3 ωc = 0.4π Figure 27: Frequency response of LPF when n /= 3 hd (n) = 1 ωc 2π −ωc e−jωτ ejωn dω h (n) = sin[0.4π(n — 3)] 1 0.4π = 2π −0.4π ejω(n−3) dω d π(n — 3)
  • 85.
    FIR Filter DesignLow Pass FIR Filter Design Dr. Manjunatha. P (JNNCE) October 25, 69 / UNIT - 7: FIR Filter when n = 3 = 2π j(n — 3) −0.4π hd (n) = 0.4π = 0.4 π
  • 86.
    FIR Filter DesignLow Pass FIR Filter Design 70 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) Determine the value of h(n) Since it is rectangular window h(n) = w (n) = hd (n) = h(n) For M=7 n h(n) n h(n) 0 -0.062341 4 -0.062341 1 0.093511 5 0.093511 2 0.302609 6 0.302609 3 0.4
  • 87.
    F FIR Filter DesignLow Pass FIR Filter Design 71 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) 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 = Fc 1000 = 0.2cycles/sample s ω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
  • 88.
    ∫   ∫ FIR FilterDesign Low Pass FIR Filter Design 72 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) 1 H (e j ) d 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. Solution: The linear phase FIR filter is nor- malized means its cut-off frequency is of ωc = 1rad/sample The length of the filter with given τ is related by M — 1  τ = 1 0 1 2 For τ = 4 M=9 Desired unit sample response hd (n) is Figure 28: Frequency response of LPF hd (n) = 1 ωc 2π −ωc e−jωτ ejωn dω when n /= 4 sin[(n — 4)] 1 1 =
  • 89.
    hd (n) = 1dω= = FIR Filter Design Low Pass FIR Filter Design 73 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) ejω(n−4) dω hd (n) = π(n — 4) 2π −1 1 " eω(n−4) #1 when n = 4 2π j(n — 4) −1 1 ∫ 1 ω 1 = −
  • 90.
    π(0 — 4 π(3— 4 h(3) = sin(3 — 4) 0.5 — 0.5cos 3π = FIR Filter Design Low Pass FIR Filter Design 74 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) h(n) = hd (n)w (n) for n = 0 to 8 h(0) = sin(0 — 4) 0.5 — 0.5cos π0 = 0.0000 this filter is 40 dB. From the table the h(1) = sin(1 — 4) 0.5 — 0.5cos π1 = 0.0022 Hanning window satisfies this require- ment. The Hanning window function given by: h(2) = π(1 — 4) sin(2 — 4) π(2 — 4) 0.5 — 0.5cos 4 2π = 0.0724 M — 1 h(4) = sin(4 — 4) 0.5 — 0.5cos 4π = 0.3183 for n /= 4 and M = 9 π(4 — 4) 4 h(5) = sin(5 — 4) 0.5 — 0.5cos 5π = 0.2286 h(n) = sin(n — 4) π(n — 4) 0.5 — 0.5cos πn i h(6) = π(5 — 4) sin(6 — 4) π(6 — 4) 0.5 — 0.5cos 4 6π = 0.0724 for n = 4 h 4 4 w (n) = 0.5 — π The stopband attenuation 4 2 4
  • 91.
    FIR Filter DesignLow Pass FIR Filter Design 75 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) 4 4 h(n) = 1 π 0.5 — 0.5cos π4 = 1 h(7) = h(8) = sin(7 — 4) π(7 — 4) sin(8 — 4) π(8 — 4) 0.5 — 0.5cos 0.5 — 0.5cos 7π 8π = 0.0022 = 0.0000
  • 92.
    Σ Σ FIR Filter DesignLow Pass FIR Filter Design UNIT - 7: FIR Filter 76 / October 25, Dr. Manjunatha. P (JNNCE) The frequency response is symmetric with M=odd=9 |H(ejω )| = h M — 1 + 2 3 M−3 2 h n=0 M — 1 — n 2 cos ω = h(4) + 2 h(n)cos ω (4 — n) n=0 = h(4) + 2h(0)cos 4ω + 2h(1)cos 3ω + 2h(2)cos 2ω + 2h(3)cos ω = 0.3183 + 0.044cos 3ω + 0.1448cos 2ω + 0.4572cos ω |H(ejω )|dB = 20log |H(ejω )| ω |H(ejω )| |H(ejω )|dB 0 1.0180 0.1550 0.1π 0.9352 -0.5815 0.2π 0.7123 -2.9464 0.3π 0.4162 -7.6132 0.4π 0.1318 -17.6023 0.5π 0.0680 -23.3498 0.6π 0.1463 -16.6936 0.7π 0.1128 -18.9561 0.8π 0.0158 -36.0322 0.9π 0.0793 -22.0154 1.0π 0.1180 -18.5624 2
  • 93.
    FIR Filter DesignLow Pass FIR Filter Design UNIT - 7: FIR Filter 77 / October 25, Dr. Manjunatha. P (JNNCE) 0 −10 −20 −30 −40 −50 10 60 − , 0 to  in radians Figure 29: Frequency response of LPF | 0 0.5 1 1.5 2 2.5 3 3.5
  • 94.
       ∫ ∫ d 0 ∫ + FIR Filter DesignHigh Pass FIR Filter Design October 25, 78 / UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) H (e j ) 1 d 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: Hd (ejω ) = e−jωτ — π ≤ ω ≤ —ωc e−jωτ ωc ≤ ω ≤ —π 0 — ωc ≤ ω ≤ ωc M — 1 τ = = 3 2 H (ejω ) = e−jωτ — π ≤ —ω ≤ ωc hd (n) = 1 π 2π −π Hd (ejω )ejωn dω  c 0 c   1 −ωc = [ ejω(n−τ ) π dω + ejω(n−τ ) dω 2π −π ωc 1 " ejω(n−τ ) #−ωc 1 " ejω(n−τ ) #π 2π j(n — τ ) −π 2π j(n — τ ) ωc =
  • 95.
    FIR Filter DesignHigh Pass FIR Filter Design October 25, 79 / UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) 1 " e−jωc (n−τ ) — e−jπ(n−τ ) + ejπ(n−τ ) — ejωc (n−τ ) # π(n — τ ) 2j =
  • 96.
    π d π (n —(n — π c π π(n — M FIR Filter Design High Pass FIR Filter Design 80 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) hd (n) = 1 " ejπ(n−τ ) — e−jπ(n−τ ) — ejωc (n−τ ) — e−jωc (n−τ ) # π(n — τ ) 1 = π(n — τ ) 2j [sinπ(n — τ ) — sinωc (n — τ ] τ = 3 ωc = 1 hd (n) = 1 [sinπ(n — 3) — sin(n — 3)] when n = τ using L Hospital rule h (n) = 1 sinπ(n — 3) — sinωc (n — 3) = 1 [π — ω ] = 1 [π — 1] The given window function is Hamming window. In this case h(n) = hd (n)ω(n)) for 0 ≤ n ≤ 6 w (n) = 0.54 — 0.46cos 2πn M — 1 h(n) = 1 [sinπ(n — 3) — sin(n — 3)] × 0.54 — 0.46cos 2πn n h(n) n h(n) 0 -0.00119 4 -0.00119
  • 97.
    FIR Filter DesignHigh Pass FIR Filter Design 81 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) 1 -0.00448 5 -0.00448 2 -0.2062 6 -0.2062 3 0.6816
  • 98.
    Σ Σ FIR Filter DesignHigh Pass FIR Filter Design Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter October 25, 82 / The magnitude response of a symmetric FIR filter with M=odd is For M=7 |H(ejω )| = h M — 1 + 2 (M−3) 2 n=0 h(n)cosω M — 1 — n 2 2 |H(ejω )| = 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ω 2
  • 99.
    2 − ∫ FIR Filter DesignBand Pass FIR Filter Design 83 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) H (e j ) 1 d 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. ω(n) = 1 for 0 ≤ n ≤ 6 0 Otherwise Solution : Hd (ω) = e−jωτ ωc1 ≤ |ωc | ≤ ωc2 0 Otherwise 1 ∫ π jωn  c2 c1 0  c1 c 2   1 "∫ −ωc1 e−jωτ ejωn dω + ∫ ωc2 e−jωτ ejωn dω # 2π −ωc2 ωc1 1 "∫ −ωc1 ejω(n−τ ) ω c2 + ejω(n−τ )dω # 2π −ωc2 ωc1 1 " ejω(n−τ ) #−ωc1 " ejω(n−τ ) #ωc2  hd (n) Hd = = d
  • 100.
    FIR Filter DesignBand Pass FIR Filter Design 84 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) = 2π  (n — τ ) + −ωc2 (n — τ ) ωc1  = sinωc2 (n — τ ) — sinωc1 (n — τ ) π(n — τ ) for n /= τ
  • 101.
    ω − 1 FIR FilterDesign Band Pass FIR Filter Design 85 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) h (n) = sinωc2 (n — τ ) — sinωc1 (n — τ ) d = ωc2 — ωc1 π π(n — τ ) for n = τ , sinωc2 (n−τ )−sinωc1 (n−τ ) for n /= τ c2 c1 π for n = τ The linear phase FIR filter is normalized means its cut-off frequency is of ωc = 1rad/sample The length of the filter with given τ is related by M — 1 τ = = 2 7 — 1 = 3 2 and ωc2 = 2 rad/sample ωc = 1rad/sample , sin2(n−3)−sin(n−3) for n /= 3 π for n = 3 for hd (n) hd (n) n h(n) n h(n) 0 -0.044 4 0.0215 1 -0.165 5 0.265 2 0.215 6 -0.044 3 0.3183 π π
  • 102.
    FIR Filter DesignBand Pass FIR Filter Design 86 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) The given window is rectangular hence h(n) = hd (n)w (n) = hd (n)
  • 103.
    Σ Σ FIR Filter DesignBand Pass FIR Filter Design Dr. Manjunatha. P (JNNCE) 87 / October 25, UNIT - 7: FIR Filter For n=0,1,2..6 estimate the FIR filter coefficients h(n). For M=7 The magnitude response of the FIR filter is given by H(ω) = h M — 1 + 2 M−3 2 n=0 h(n)cos ω M — 1 — n 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. 2
  • 104.
    2 − ∫ FIR Filter DesignBand Pass FIR Filter Design Dr. Manjunatha. P (JNNCE) October 25, 88 / UNIT - 7: FIR Filter H (e j ) 1 d Design an ideal bandpass filter having frequency response H e(jω) for π ≤ |ω| ≤ 3π d 4 4 Use rectangular window with N=11 in your design Solution : Hd (ω) = e−jωτ ωc1 ≤ |ωc | ≤ ωc2 0 Otherwise 1 ∫ π jωn  c2 c1 0  c1 c 2   1 "∫ −ωc1 e−jωτ ejωn dω + ∫ ωc2 e−jωτ ejωn dω # 2π −ωc2 ωc1 1 "∫ −ωc1 ejω(n−τ ) ω c2 + ejω(n−τ )dω # 2π −ωc2 ωc1 hd (n) Hd = = d
  • 105.
    FIR Filter DesignBand Pass FIR Filter Design Dr. Manjunatha. P (JNNCE) October 25, 89 / UNIT - 7: FIR Filter 1 " ejω(n−τ ) #−ωc1 " ejω(n−τ ) #ωc2  = 2π  (n — τ ) + −ωc2 (n — τ ) ωc1  = sinωc2 (n — τ ) — sinωc1 (n — τ ) π(n — τ ) for n /= τ
  • 106.
    4 4 ω −  FIRFilter Design Band Pass FIR Filter Design 90 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) h (n) = sinωc2 (n — τ ) — sinωc1 (n — τ ) d = ωc2 — ωc1 π π(n — τ ) for n = τ , sinωc2 (n−τ )−sinωc1 (n−τ ) for n /= τ c2 c1 π The length of the filter with given τ is related by M — 1 for n = τ for 11 — 1 τ = = = 5 2 2 and ωc = π rad/sample ωc = 3π rad/sample 2 4 4   sin h 3π(n−5) i −sin h π(n−5) i for n /= 5 hd (n) = π(n−5) 3π π 4 − 4 π for n = 5 for The given window is rectangular hence hd (n) π
  • 107.
    FIR Filter DesignBand Pass FIR Filter Design 91 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) h(n) = hd (n)w (n) = hd (n) For n=0,1,2..10 estimate the FIR filter coefficients h(n).
  • 108.
    ∫ + FIR Filter DesignBand Pass FIR Filter Design October 25, 92 / UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) H (e j ) 1 d Design a BPF using Hanning window with M=7. Given that lower cutoff frequency ωc1 = 2rad/sec and ωc2 = 3rad/sec. Solution: Hd (ejω ) = e−jωτ for — ωc2 ≤ ω ≤ —ωc1 e−jωτ for ωc1 ≤ ω ≤ ωc2 0 for — ωc — ωc1ω ≤ ωc1 M — 1 τ = = 3 2 The inverse transform of the Hd (eω ) is hd (n) = 1 ∫ π Hd (ejω )ejωn dω  c2 c1 0 c1 c 2   2π −π 1 −ωc1 = [ ejω(n−τ )dω + ∫ ωc2 ejω(n−τ ) dω 2π −ωc2 ωc1 1 " ejω(n−τ ) #−ωc1 1 " ejω(n−τ ) #ωc1    =
  • 109.
    FIR Filter DesignBand Pass FIR Filter Design October 25, 93 / UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) 2π j(n — τ ) 1 −ωc2 2π j(n — τ ) ωc2 = π(n — τ ) [sinωc2(n — τ ) — sinωc1(n — τ ]
  • 110.
    d FIR Filter DesignBand Pass FIR Filter Design 94 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) τ = M−1 = 7−1 = 3 2 2 ωc1 = 2 rad/sec ωc2 = 3 rad/sec for n /= 3 hd (n) = 1 π(n — 3) [sin3(n — 3) — sin2(n — 3)] for n = τ h (n) = 1 lim sinωc2(n — τ ) — lim sinωc1(n — τ ) hd (n) = 1 1 [ωc2 — ωc1] = π π The given window function is Hanning window ω(n) = 0.5 — 0.5cos 2πn M — 1 π n (n — n (n — n h(n) n h(n) 0 0 4 0 1 0.0189 5 0.0189 2 -0.01834 6 -0.01834 3 0.3183
  • 111.
    π(n — M FIRFilter Design Band Pass FIR Filter Design 95 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) 0 ≤ n ≤ M — 1 This is rectangular window of length M=11. In this case h(n) = hd (n)ω(n) = hd (n) for 0 ≤ n ≤ 6 h(n) = sin3(n — τ ) — sin2(n — τ ) 0.5 — 0.5cos 2πn
  • 112.
    Σ Σ Σ Σ FIR Filter DesignBand Pass FIR Filter Design Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter 96 / October 25, M−1 6 H(z ) = Σ h(n)z −n = Σ h(n)z −n = 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 = 0 + 0.0189z −1 — 0.1843z −2 + 0.3183z −3 — 0.1834z −4 + 0.0189z −5 + 0 The magnitude response of a symmetric FIR filter with M=odd is For M=7 |H(ejω )| = h M — 1 + (M−1)/2 2h n=1 M — 1 — n 2 cosωn 3 |H(ejω )| = h (3) + 2h (3 — n) cosωn n=1 3 |H(ejω )| = h (3) + 2h (3 — n) cosωn n=1 5 = h(3) + 2h (5 — n) cosωn n=1 = h(3) + 2h(2)cosω + 2h(1)cos2ω + 2h(0)cos3ω 2 n n
  • 113.
    FIR Filter DesignBand Pass FIR Filter Design Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter 97 / October 25, = 0.3183 — 0.3668cosω + 0.0378 cos2ω
  • 114.
    ∫ ∫ H (ejω ) =  e−jωτ for— ωc1 ≤ ω ≤  ∫ FIR Filter Design Bandstop FIR Filter Design October 25, 98 / UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) 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:   e−jωτ for — π ≤ ω ≤ —ωc2 d e −jωτ for ωc2  ≤ ω ≤ π hd (n) = 1 π 2π −π Hd (ejω )ejωn dω 1 −ωc2 = [ ejω(n−τ )dω + ∫ ωc1 ejω(n−τ ) π dω + ejω(n−τ ) dω 2π −π −ωc1 ωc2 1 " ejω(n−τ ) #−ωc2 1 " ejω(n−τ ) #ωc1 1 " ejω(n−τ ) #π 0 for ωc1 ≤ |ω| ≤ = + 1 H (e j ) d    0    
  • 115.
    FIR Filter DesignBandstop FIR Filter Design October 25, 99 / UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) 2π j(n — τ ) −π 1 2π j(n — τ ) −ωc1 2π j(n — τ ) ωc2 = π(n — τ ) [sinωc1(n — τ ) + sinπ(n — τ — sinωc2(n — τ ] +
  • 116.
    d FIR Filter DesignBandstop FIR Filter Design 100 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) The inverse transform of the Hd (eω ) is τ = M−1 = 5−1 = 2 ωc1 = 2 rad/sec ωc2 = 3 rad/sec 2 2 hd (n) = 1 π(n — 2) [sin2(n — 2) + sinπ(n — 2) — sin3(n — 2)] for n /= 2 for n = τ h (n) = 1 lim sinωc1(n — τ ) + lim sinπ(n — τ ) — lim sinωc2(n — τ ) hd (n) = 1 [ωc1 + π — ωc2] = π 1 [π — 1] π The given window function is Rectangular window ω(n) = 1 0 ≤ n ≤ M — 1 This is rectangular window of length M=5. In this case h(n) = hd (n)ω(n) = hd (n) for 0 ≤ n ≤ 4 π n (n — n (n — n (n —
  • 117.
    FIR Filter DesignBandstop FIR Filter Design 101 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) 1 hd (n) = π(n — 2) [sin2(n — 2) + sinπ(n — 2) — sin3(n — 2)] for n /= 2
  • 118.
    FIR Filter DesignBandstop FIR Filter Design 102 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) n = 0 h(0) = sin2(0 — 2) + sinπ(0 — 2) — sin3(0 — 2) = —0.0759 π(0 — 2) n = 1 h(1) = sin2(1 — 2) + sinπ(1 — 2) — sin3(1 — 2) = 0.2445 π(1 — 2) n = 2 h(2) = 1 [π — 1] = 0.6817 π n = 3 h(3) = sin2(3 — 2) + sinπ(3 — 2) — sin3(3 — 2) = 0.2445 π(3 — 2) n = 4 h(4) = sin2(4 — 2) + sinπ(4 — 2) — sin3(4 — 2) = —0.0759 π(4 — 2) M−1 4 H(z ) = Σ h(n)z −n = Σ h(n)z −n = h(0) + h(1)z −1 + h(2)z −2 + h(3)z −3 + h(4)z −4 n n
  • 119.
    FIR Filter DesignBandstop FIR Filter Design 103 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) = —0.0759 + 0.2445z −1 + 0.6817z −2 + 0.2445z −3 — 0.0759z −4
  • 120.
    Σ Σ Σ FIR Filter DesignBandstop FIR Filter Design Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter October 25, 104 / The magnitude response of a symmetric FIR filter with M=odd is For M=5 |H(ejω )| = h M — 1 + (M−1)/2 2h n=1 M — 1 — n 2 cosωn 2 |H(ejω )| = h (2) + 2h (2 — n) cosωn n=1 3 |H(ejω )| = 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ω 2
  • 121.
    M 105 / October 25, UNIT- 7: FIR Filter Dr. Manjunatha. P (JNNCE) FIR Filter Design Using Kaiser Window The Kaiser window is parametric and its bandwidth as well as its sidelobe energy can be designed. Mainlobe bandwidth controls the transition characteristics and sidelobe energy affects the ripple characteristics. The Kaiser window function is given by wk (n) = I0 " α r 1 — 2n I0(α) 2 # where M is the order of the filter, I0(x ) is a zeroth Bessel function of the first kind Σ∞ 1 x k = 1 + 0.25x 2 (1!)2 + (0.25x 2 )2 (2!)2 + (0.25x 2 )3 (3!)2 + I0(x ) = 1 k k 2
  • 122.
    106 / October 25, UNIT- 7: FIR Filter Dr. Manjunatha. P (JNNCE) α = 0 if A < 21 = 0.5842(A — 21)0.4 + 0.07886(A — 21) if 21 ≤ A ≤ 50 dB = 0.1102(A — 8.7)) if A > 50 dB
  • 123.
    FIR Filter DesignFIR Filter Design Using Kaiser Window 107 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) H () 1 1 1 1 1 A˜P 1 Passband ripple 2 Stopband ripple Ideal LPF A˜ S  2 PCS Passband Transitio n band  Stopband Ga
  • 124.
    FIR Filter DesignFIR Filter Design Using Kaiser Window 108 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) Figure 30: Frequency response of LPF
  • 125.
    d 2   0 forA ≤ FIR Filter Design FIR Filter Design Using Kaiser Window Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter October 25, 109 / 1 2 3 4 Kaiser Window Design Equations Determine ideal frequency response H (ejω ) = 1 for |ω| ≤ ωc 0 for ωc ≤ |ω| ≤ π where ωc = 1 (ωp + ωs ) 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 100.05A˜ p −1 δ = min(δp, δs ) −0.05A˜ where δp = 0 ˜ and δs = 10 s 10 .05Ap +1 The actual stopband attenuation is A = —20log10δ The parameter α is α = 0.5842(A — 21)0.4 + 0.07886(Aa — 21) for 21 < A ≤ 50
  • 126.
    FIR Filter DesignFIR Filter Design Using Kaiser Window Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter October 25, 110 /  0.1102(A — 8.7) for A > 50
  • 127.
    Σ FIR Filter DesignFIR Filter Design Using Kaiser Window Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter October 25, 111 / 5 6 7 8 The value of M is found by A — 7.95 M ≥ 14.36∆f where ∆f = ∆ω = ωs −ωp and ∆ω is the width of transition band 2π 2π Obtain impulse response by multiplying Kaiser window function h(n) = hd (n)wk (n) Obtain the causal finite impulse response The system function is given by M−1 H(z ) = h(n)z −n n=0
  • 128.
    4 d = ∫ FIR Filter DesignFIR Filter Design Using Kaiser Window 112 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) Design a lowpass filter with a cutoff frequencies from wc = π ∆ω = 0.02π and a stopband ripple δs = 0.01. Use Kaiser window Solution: H (ejω ) = 1 for |ω| ≤ ωc 0 for ωc ≤ |ω| ≤ π The inverse transform of the Hd (ejω ) is A = —20logδs = —20log (0.01) = 40 dB hd (n) = 1 ∫ π Hd (ejω )ejωn dω α = 0.5842(A — 21)0.4 + 0.07886(A — 21) 0.4 2π −π = 0.5842(40 — 21) + 0.07886(40 — 21) 1 ωc = ejωn dω = 3.4 2π −ωc 1 ejωn ωc 0.02π = ∆f 2 j −
  • 129.
    h FIR Filter DesignFIR Filter Design Using Kaiser Window 113 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) = 1 ejωc n — e−jωc n 2jπn 1 ejωc n — e−jωc n A — 7.95 M ≥ 14.36∆f ≥ 223.189 ' 225 = πn 2j = sinωc n πn 225 — 1 τ = 2 = 112
  • 130.
    M I0 3.4 , 1 — FIRFilter Design FIR Filter Design Using Kaiser Window 114 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) 2 # I0 " α r 1 — 2n wk (n) = wk (n) = 0 ≤ n ≤ M — 1 I0(α) 2n 2 224 0 ≤ n ≤ M — 1 I0(3.4) I0 3.4 , 1 — 2n 2 wher e h(n) = hd × wk (n) = 1 [sinωc n] × πn I0(3.4) 224 ' ωc = ωc + ∆ω = 0.25π + 2 0.02π = 0.26π 2
  • 131.
    s October 25, 115/ UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) FIR Filter Design FIR Filter Design Using Kaiser Window A/D Filter D/A 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: x(t) x(n) y(n) y(t) A = —20logδs = 40 dB logδs = —2 ⇒ δs = 0.01 20log (1 + δp ) = 0.01 ∆ω = Ω ∆ 1000π f = 10 × 103 = 0.1π rad 0.1π log (1 + δp ) = 0.0005 ∆f = = 0.05 2π δp = 0.00115 A — 7.95 58.8 — 7.95 M ≥
  • 132.
    October 25, 116/ UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) FIR Filter Design FIR Filter Design Using Kaiser Window = 70.82 ' 71 δmin(δp, δs ) = 0.00115 A = —20log (0.00115) = 58.8 dB 14.36∆f τ = 14.36 × 0.05 71 — 1 = 35 2
  • 133.
    h I 7 1 2 π ∫ FIR Filter DesignFIR Filter Design Using Kaiser Window Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter October 25, 117 / The attenuation is 58.8 dB then the parameter α is α = 0.1102(A — 8.7) Hd (ejω ) = 1 for |ω| ≤ ωc 0 for ωc ≤ |ω| ≤ π = 0.1102(58.8 — 8.7) ' 5.5 I0 5.5 , 1 — 2n 2 The inverse transform of the Hd (ejω ) is ∫ 1 ωc = ejωn dω 1 2π −ωc ωc = Ωc × T = 2400π × 10 × 103 1 ejωn ωc = 0.24π 2π jn −ωc ' ∆ω ω c = ωc + 2 = 1 ejωc n — e−jωc n 2jπn = wk (n) hd (n) Hd j ) j d
  • 134.
    I0 5.48 , 1 — FIRFilter Design FIR Filter Design Using Kaiser Window Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter October 25, 118 / 1 ejωc n — e−jωc n = 0.24π + 0.1π = 0.29π 2 πn 2j = sinωc n πn h(n) = hd × wk (n) = 1 π(n — τ ) [sinωc (n — τ )] × 2n 2 224 I0(5.5) =
  • 135.
    h ) 25 π ∫ FIR FilterDesign FIR Filter Design Using Kaiser Window Dr. Manjunatha. P (JNNCE) 119 / October 25, UNIT - 7: FIR Filter 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: Hd (ejω ) = 1 for |ω| ≤ ωc 0 for ωc ≤ |ω| ≤ π The inverse transform of the Hd (ejω ) is ∆ω = ωs — ωp = 10rad/sec 1 1 ∫ π jω jωn ωc = (ωp + ωs ) = 25rad/sec 2 1 ωc = ejωn dω −0.05A 100 2 −0.05×44 −3 2π −ωc δs = 10 s = 10 = 6.3096 × 10 1 ejωn ωc δp = 100.05Ap — 1 = 100.05×0.1 — 1 = 5.7563×10−3 2π jn −ωc 100.05Ap + 1 100.05×0.1 + 1 = 1 ejωc n — e−jωc n 2jπn sinωc n hd (n) 2 − Hd = d
  • 136.
    FIR Filter DesignFIR Filter Design Using Kaiser Window Dr. Manjunatha. P (JNNCE) 120 / October 25, UNIT - 7: FIR Filter δ = min(δp, δs ) = 5.7563 × 10−3 A = —20log10(δ) = 44.797dB = πn
  • 137.
    M I0 3.9524 , 1 — FIRFilter Design FIR Filter Design Using Kaiser Window 121 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) α = 0.5842(A — 21)0.4 + 0.07886(A — 21) = 0.5842(44.797 — 21)0.4 + 0.07886(44.797 — 21) = 3.9524 ∆f = ∆ω ωsf 10 = 10 0 = 0.1 A — 7.95 M ≥ ≥ 14.36∆f 44.797 — 7.95 14.36 × 0.1 27 — 1 ≥ 25.66 ' 27 τ = = 13 2 2 # I0 " α r 1 — 2n wk (n) = wk (n) = 0 ≤ n ≤ M — 1 I0(α) 2n 2 27 0 ≤ n ≤ M — 1 I0(3.9524)
  • 138.
    FIR Filter DesignFIR Filter Design Using Kaiser Window 122 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) I0 3.9524 , 1 — 2n 2 h(n) = hd × wk (n) = 1 [sinωc n] × πn 27 I0(3.9524)
  • 139.
    UNIT - 7:FIR Filter 123 / October 25, Dr. Manjunatha. P (JNNCE) FIR Filter Design FIR Filter Design Using Kaiser Window d ∫ h ∫ 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 αp ≤ 0.1dB Stopband ripple αs ≥ 40dB Sampling frequency F = 10000Hz Solution: H (ejω ) = 0 for |ω| ≤ ωc 1 for ωc ≤ |ω| ≤ π The inverse transform of the Hd (ejω ) is ∆ω = ωp — ωs = 3200π rad/sec 1 hd (n) = 1 −ωc 2π ejωn π dω + ejωn dω ωc = (ωp + ωs ) = 4800π rad/sec 2 4800 −π 1 " ejωn −ωc ωc ejωn π # ωc (discrete, radian) = 2000 0 (2π) = 0.48πrad = 1 e−jωc n — e−jπn + ejπn — ejωc n 2jπn = sinπn — sinωc n 100.05Ap −1 100.05×0.1−1 πn ωp = 2πfp = 6400π rad/sec = + δs = 10 −0.05As = 10 −0.05×40 = 2 j − j ω
  • 140.
    UNIT - 7:FIR Filter 124 / October 25, Dr. Manjunatha. P (JNNCE) FIR Filter Design FIR Filter Design Using Kaiser Window ωs = 2πfs = 3200π rad/sec ωsf = 2πF = 20000π rad/sec δp = 100.05Ap +1 = 100.05×0.1+1 = 0.005756 δ = min(δp, δs ) = 5.756 × 10−3 A = —20log10(δ) = 44.797dB
  • 141.
    UNIT - 7:FIR Filter 125 / October 25, Dr. Manjunatha. P (JNNCE) FIR Filter Design FIR Filter Design Using Kaiser Window
  • 142.
    FIR Filter DesignFIR Filter Design Using Kaiser Window October 25, 126 / UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) M I0 3.9524 , 1 — α = 0.5842(A — 21)0.4 + 0.07886(A — 21) = 0.5842(44.797 — 21)0.4 + 0.07886(44.797 — 21) = 3.9524 ∆f = ∆ω ωsf 3200π = 2000 0π = 0.16 A — 7.95 M ≥ ≥ 14.36∆f 44.797 — 7.95 14.36 × 0.16 17 — 1 ≥ 16.03 ' 17 τ = = 8 2 2 # I0 " α r 1 — 2n wk (n) = wk (n) = 0 ≤ n ≤ M — 1 I0(α) 2n 2 17 0 ≤ n ≤ M — 1 I0(3.9524)
  • 143.
    FIR Filter DesignFIR Filter Design Using Kaiser Window October 25, 127 / UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) I0 3.9524 , 1 — 2n 2 h(n) = hd × wk (n) = sinπn — sinωc n × πn 27 I0(3.9524)
  • 144.
    Design of FIRsystem Frequency Sampling for FIR Filters Dr. Manjunatha. P (JNNCE) October 25, 128 / UNIT - 7: FIR Filter Design of FIR filter using Frequency Sampling With necessary mathematical analysis explain the frequency sampling technique of FIR filter design
  • 145.
    Design of FIRsystem Frequency Sampling for FIR Filters M October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) 129 / | H () |k d   2 k  2k M 17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 4 8  17 17 2  ()  203 17 2 30 2 17     16k   16 (k 17) k k 8 k 17 17 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 = M k k = 0, 1, . . . M — 1 The discrete time Fourier transform (DTFT) is H(k) = Hd (ω)|ω=ωk K=0  = Hd 2π k k = 0, 1, . . . M — 1  The inverse M point DFT (IDFT) h(n) is M−1 Magnitude frequency response is symmetric about π, while ideal phase response is antisymmetric about π 1 Σ h(n) = H(k)ejωn
  • 146.
    Design of FIRsystem Frequency Sampling for FIR Filters October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) M 130 / M n=0 M−1 = 1 Σ H(k)ej 2πkn n = 0, 1, . . . M — 1 M n=0
  • 147.
    Design of FIRsystem Frequency Sampling for FIR Filters Dr. Manjunatha. P (JNNCE) 131 / October 25, UNIT - 7: FIR Filter 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)ej2πn(M−k)/M H(M — k)ej2πn(M−k)/M = H(M — k)ej2πn e−j2πkn/M H(M — k)ej2πn(M−k)/M = H(M — k)e−j2πkn/M ∵ ej2πn = cos(2πn) + jsin(2πn) = 1 substituting the |H(M — k)| = |H(k)| H(M — k)ej2πn(M−k)/M = H(k)e−j2πkn/M The term H(k)e−j2πkn/M is complex conjugate of H(k)ej2πkn/M . Hence H(M — k)ej2πn(M−k)/M is complex conjugate of H(k)e−j2πkn/M H(M — k) = H∗ (k)
  • 148.
    Σ Σ 2 M — 1 ifM is P Design of FIR system Frequency Sampling for FIR Filters 132 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) If H(M — k) = H ∗ (k) then h(n) h(n) = 1 M H(0) + 2 Re k=1 h H(k)ej2πkn/M i ! where P is M−1 if M is odd This equation is used to compute the coefficients of FIR filter. H(z) is M−1 H(z ) = h(n)z −n n=0 M−1 H(ω) = h(n)e−jωn n=0 , Σ P 2
  • 149.
    , e−j 8 0 ≤2πk π 2 0 2 ≤ ω Design of FIR system Frequency Sampling for FIR Filters 133 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) | H () | d   2 k  2 k k M17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 4 8  17 17 2  ()  203 172 30 17 2      16k   16 (k 17) k k 8 k 17 17 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 , e −jω, M−1 0 ≤ ω ≤ π Hd (ω) = 0 π 2 K=0 2 ≤ ω ≤ π e −j8ω 0 ≤ ω ≤ π  To sample put ω = 2πk = 2πk  M 17 Hd (ω) = 2πk 17 17 2 0 π ≤ 2πk ≤ π 2 17 The range of k is 2πk = π k = 17 ' 4 17 2 4 2 Hd (ω)
  • 150.
    H (ω) e 170 ≤ k 4 1 2 0 17 ≤ k ≤ Design of FIR system Frequency Sampling for FIR Filters 134 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) , −j 16πk 17 2πk = π k = 17 ' 8 4 2 d
  • 151.
    . Σ , ,  , 4 4 1 1 √  h Design of FIRsystem Frequency Sampling for FIR Filters 135 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) The value of h(n)is given by The range of k is 0 ≤ k ≤ 17 h(n) = 1 H(0) + 2 M , Σ M−1 2 Re k=1 h h H(k)ej2πkn/M i ! i , . Hence the range is 0 ≤ k ≤ 4 Similarly 17 ≤ k ≤ 17 = 4.25 ≤ k ≤ 8.5 17 k=1 4 2 The range 5 ≤ k ≤ 8 |H(k)| = 1 0 ≤ k ≤ 4 |H(k)| = 1 0 ≤ k ≤ 4 0 5 ≤ k ≤ 8 , 1 13 ≤ k ≤ 16 h(n) = 1 1 + 2 17 Re e k=1 16πk 17 e j2πkn/17 i ! 1 = 1 + 2 17 Re k=1 h ej2πk(n−8)/17 i ! 8 − k is an R H(k)ej2πkn/ , Σ Σ 4 4
  • 152.
    , 1 Design of FIRsystem Frequency Sampling for FIR Filters 136 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) 1 = 1 + 2 17 Σ k=1 cos 2πk(n — 8) !
  • 153.
    Design of FIRsystem Frequency Sampling for FIR Filters Dr. Manjunatha. P (JNNCE) 137 / UNIT - 7: FIR Filter October 25, 2 2 2 2 π 2 e | H () | d   2 k  2 k k 1 M7 2345 6 7 2 7  ()  4 2 7 6 7  8 10 3 12 77 27 2       6k   6 (k  7) k k 3 k 7 7 Determine the impulse response h(n) of a filter having desired frequency response H (w ) = , −j , (M−1)ω 0 ≤ |ω| ≤ π d 0 π ≤ ω ≤ π M=7 use frequency sampling approach. Solution: The Ideal LPF frequency response Hd (ω) is H (ω) = , −jω , M−1 0 ≤ ω ≤ π K=0 d 0 π 2 2 ≤ ω ≤ π  e−j3ω 0 ≤ ω ≤ π 0 2 ≤ ω ≤ π To sample put ω = 2πk = 2πk  M , −j 2πk 3 7 2πk π H (ω) = e 7 0 ≤ 7 ≤ 2 d 0 π ≤ 2πk ≤ π 2 7 The range of k is Hd (ω) e
  • 154.
    Design of FIRsystem Frequency Sampling for FIR Filters Dr. Manjunatha. P (JNNCE) 138 / UNIT - 7: FIR Filter October 25, 7 4 7 2 4 0 7 ≤ k 2πk = π k = 7 , e−j 6πk 0 ≤ k ≤ 7 2πk = π k = 7 ' 1 4 2 7 2 H (ω) d
  • 155.
    Design of FIRsystem Frequency Sampling for FIR Filters Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter October 25, 139 / 4 . Σ , , 7 , 1 √  7 The value of h(n)is given by The range of k is 0 ≤ k ≤ 7 k is an integer. Hence the range is 0 ≤ k ≤ 1 Similarly 7 ≤ k ≤ 7 = 1.75 ≤ k ≤ 3.5 h(n) = 1 H(0) + 2 M M−1 2 k=1 Re h H(k)ej2πkn/M i , . 4 2 , Σ h i ! The range 2 ≤ k ≤ 3 ,  1 0 ≤ k ≤ 1 1 = 1 + 2 7 Re k=1 H(k)e j2πkn/7 |H(k)| = 0 2 ≤ k ≤ 3 , 1 k = 6 |H(k)| = 1 0 ≤ k ≤ 1 h(n) = 1 1 + 2 7 1 , Re k=1 Σ h e−j h 6πk j2πkn/7 i ! i ! = 1 + 2 7 1 = 1 + 2 7 k=1 Σ k=1 Re cos ej2πk(n−3)/7 2πk(n — 3) ! 3 1 Σ n h(n) n h(n) 0 -0.1146 4 321 1 0.0793 5 0.0793 2 0.321 6 -0.1146 3 0.4283 1
  • 156.
    Design of FIRsystem Frequency Sampling for FIR Filters Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter October 25, 140 / 0 2 Determine the filter coefficients h(n) obtained by frequency sampling Hd (w ) given by ( e −j3ω 0 ≤ |ω| ≤ π 2 ≤ ω ≤ π Also obtain the frequency response H(w ). Take N=7. DEC 2011 Hd (w
  • 157.
    Design of FIRsystem Frequency Sampling for FIR Filters UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) October 25, 141 / 1 0 k = 4, 5, 1 1 k M     14k   14 (k  15) k k 7 k 15 15 Proakis Exercise 8.6 Determine the filter coefficients h(n) of a linear phase FIR of length M=15 which has symmetric unit impulse response and the frequency response that satisfies the coefficients. H 2π k = 1 k = 0, 1, 2, 3 Solution: |H(k)| = 1 0 ≤ k ≤ 3 0 4 ≤ k ≤ 11 , 1 12 ≤ k ≤ 14 K=0    ,  | Hd () | 1 2 4 3 4 6    2 k  5 6 7 8  2 k 15 9 1 8 10 11 12 3 13 14 15 28 2 15 15 2 15 2 15 — 14 πk 0 ≤ k ≤ 7  () θ (k) 14π — 15 πk = — 15 π(k — 15) 8 ≤ k ≤ 
  • 158.
    . Σ , , 1 e 15 = 1 Design ofFIR system Frequency Sampling for FIR Filters 142 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) The value of h(n)is given by h(n) = 1 √ M  1 , H(0) + 2 Σ M−1 2 Re k=1 h h H(k)ej2πkn/M i ! i , . |H(k)| = 1 0 ≤ k ≤ 3 1 , Σ h 17πk i ! 1 = 1 + 2 15 7 3 1 H h(n) k R n h(n) n h(n) 0 -0.05 8 0.3188 1 0.041 9 0.034 2 0.066 10 -0.108 3 -0.036 11 -0.036 4 -0.108 12 0.066 5 0.034 13 0.041 6 0.3188 14 -0.05 7 0.466 k R 7 3
  • 159.
    , 3 1 Design of FIRsystem Frequency Sampling for FIR Filters 143 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) Re k=1 h ej2πk(n−7)/15 i ! 1 = 1 + 2 15 Σ k=1 cos 2πk(n — 7) ! Σ
  • 160.
    ,  Design of FIRsystem Frequency Sampling for FIR Filters 144 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) | Hd () | 1 2 k 15 4 15 2      14k   14 (k 15) k k 7 k 15 15 Proakis Exercise 8.7 Determine the filter coefficients h(n) of a linear phase FIR of length M=15 which has symmetric unit impulse response and the frequency response that satisfies the coefficients. Solution: |H(k)| =  2π H k = 15 0.4 k = 4 0 5 ≤ k ≤ 10 1 k = 0, 1, 2, 3 0.4 k = 4 , 0 k = 5, 6, 7 K=0 θ(k) = ,  1 0 ≤ k ≤ 3  , 0.4 k = 11 3 4 0.4 6  15 2   2 k  M 5 6 7 8  2 k 15 9 1 8 15 10 11 12 0.4 3 2 13 14 2 8 15  () — 14 πk 0 ≤ k ≤ 7
  • 161.
    Design of FIRsystem Frequency Sampling for FIR Filters 145 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) 1 12 ≤ k ≤ 14   15 — 14 π(k — 15) 8 ≤ k ≤ 14 15
  • 162.
    . Σ , − , , 3 h = 1 k Design ofFIR system Frequency Sampling for FIR Filters 146 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) The value of h(n)is given by h(n) = 1 √ M  1 , H(0) + 2 Σ M−1 2 Re k=1 h h H(k)ej2πkn/M i ! i , . |H(k)| = 1 0 ≤ k ≤ 3 |H(k)| = 0.4 k = 4&11 1 h(n) = 71 5 , 1 + 2 Re k=1 17πk e 15 e j2πkn/15 i ! 1 = 1 + 2 15 Re k=1 h ej2πk(n−7)/15 i + 2Re h 0.4ej2π4(n−7)/15 i ! 1 = 1 15 7 1 H Σ Σ n h(n) n h(n) 0 -0.0143 8 0.313 1 -0.002 9 -0.0181 2 0.04 10 -0.091 3 0.0122 11 0.0122 4 -0.091 12 0.04 5 -0.0181 13 -0.002 6 0.313 14 -0.0143 7 0.520 R 3 3
  • 163.
    1 Design of FIRsystem Frequency Sampling for FIR Filters 147 / October 25, UNIT - 7: FIR Filter Dr. Manjunatha. P (JNNCE) Σ k=1 cos 2πk(n — 7 ) 1 5 + 0.8cos 8π(n — 7) !
  • 164.
    148 / October 25, UNIT- 7: FIR Filter Dr. Manjunatha. P (JNNCE) References J. G. Proakis and D. G. Monalakis, Digital signal processing Principles Algorithms & Applications, 4th ed. Pearson education, 2007. Oppenheim and Schaffer, Discrete Time Signal Processing. Pearson education, Prentice Hall, 2003. S. K. Mitra, Digital Signal Processing. Tata Mc-Graw Hill, 2004. L. Tan, Digital Signal Processing. Elsivier publications, 2007.