0% found this document useful (0 votes)
2K views94 pages

UNIT - 7: FIR Filter Design: Dr. Manjunatha. P Professor Dept. of ECE

This document discusses FIR filter design. It begins with an introduction to FIR filters, including their advantages such as linear phase response and stability. It then covers the design of FIR filters using different windowing techniques, including rectangular, Hamming, Hanning, Bartlett, and Kaiser windows. It also mentions the design of FIR filters using frequency sampling techniques. The document is a set of lecture slides on FIR filter design for a digital signal processing course. It provides an overview of key concepts and methods for designing finite impulse response filters.

Uploaded by

Bala Murugan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views94 pages

UNIT - 7: FIR Filter Design: Dr. Manjunatha. P Professor Dept. of ECE

This document discusses FIR filter design. It begins with an introduction to FIR filters, including their advantages such as linear phase response and stability. It then covers the design of FIR filters using different windowing techniques, including rectangular, Hamming, Hanning, Bartlett, and Kaiser windows. It also mentions the design of FIR filters using frequency sampling techniques. The document is a set of lecture slides on FIR filter design for a digital signal processing course. It provides an overview of key concepts and methods for designing finite impulse response filters.

Uploaded by

Bala Murugan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 94

UNIT - 7: FIR Filter Design

Dr. Manjunatha. P
manjup.jnnce@gmail.com

Professor
Dept. of
ECE

J.N.N. College of Engineering,


Shimoga

October 25, 2016


Unit 7 Syllabus Introduction

FIR Filter Design:[1, 2, 3, 4]

Slides are prepared to use in class room purpose, may be used as a


reference material
All the slides are prepared based on the reference material
Most of the figures/content used in this material are redrawn, some
of the figures/pictures are downloaded from the Internet.
This material is not for commercial purpose.
This material is prepared based on Digital Signal Processing for
ECE/TCE course as per Visvesvaraya Technological University (VTU)
syllabus (Karnataka State, India).

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 2 / 94
Unit 7 Syllabus

Unit 7: FIR Filter Design:

PART-B-Unit 7: FIR Filter Design:

Introduction to FIR Filters


Design of FIR Filters
using
1 Rectangular window
2 Hamming window
3 Hanning window
4 Bartlet window
5 Kaiser window
Design of FIR Filter using frequency sampling technique.

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 3 / 94
FIR Filter Design Introduction

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.
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 4 / 94
FIR Filter Design Introduction
An ideal lowpass filter is given by
j
H (e )
. 1
d

1 |ω| ≤ ωc
H(ω) =
0 ωc < |ω| ≤ π

 c c  
The impulse response is given by 0
Figure 1: Ideal low pass filter
∫ωc , ωc
1 π n= 0
h(n) = H(ω)ejωn dω = sin(ωcn)
2π ωc
π
n ƒ= 0
ωc n
−ω c

Paley-Wiener Theorem:
If h(n) has finite energy and h(n) = 0 for n < 0
then
∫π
| ln |H(ω)||dω < Figure 2: Unit sample response
−π ∞

H(ω) can be zero at some frequencies. but it cannot be zero over any finite of
frequencies, since the integral then becomes infinite.
H(ω) cannot be exactly zero over any band of frequencies. (Except in the trivial
case where h[n]
= 0.) Furthermore, |H(ω)| cannot be flat (constant) over any finite band.
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 5 / 94
FIR Filter Design Introduction

Magnitude Characteristic of FIR filter


The magnitude response can be expressed as
.
1 − δ1 ≤ |H(ω)|1 + δ for 0 ≤ ω ≤ ω p
Magnitude =
0 ≤ |H(ω)δ
1 2 for ωs ≤ ω ≤ π

Approximate formula for order N is


δ1 ‐‐Passband ripple
−10log10(δ1δ2) − 15
N= δ2 ‐‐ Stopband ripple ωp‐‐

ω −ω14∆f
Passband edge frequency ωs‐‐

where ∆ f = s2π p = fs − f p Stopband edge frequency


Approximate formula for order N is

N= k
ωs − ωp

The width of the main lobe is


N = k 2π
M
Figure 3: Magnitude Specification of FIR

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 6 / 94
FIR Filter Design Introduction

Ideal filters are noncausal, hence physically unrealizable for real time signal processing
applications.
Causality implies that the frequency response characteristic H(ω) of the filter cannot be
zero, except at finite set of points in the frequency range. And also H(ω) cannot have an
infinitely sharp cutoff from passband to stopband, that is H(ω) cannot drop from unity to
zero abruptly.
It is not necessary to insist that the magnitude be constant in the entire passband of the
filter. A small amount of ripple in the passband is usually tolerable.
The filter response may not be zero in the stopband, it may have small nonzero value or
ripple.
The transition of the frequency response from passband to stopband defines transition
band.
The passband is usually called bandwidth of the filter.
The width of transition band is ωs − ωp where ωp defines passband edge frequency and ωs
defines stopband edge frequency.
The magnitude of passband ripple is varies between the limits 1 ± δ1 where δ1 is the ripple
in the passband
The ripple in the stopand of the filter is denoted as δ2

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 7 / 94
FIR Filter Design FIR Filter Design

FIR Filter Design

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 8 / 94
FIR Filter Design FIR Filter Design

An FIR system does not have feedback. Hence y (n − k) term is absent in the system. FIR
output is expressed as

ΣM
y (n) = bkx (n −
k) k=0

If there are M coefficients then


Σ− 1
M
y (n) = bkx (n −
k) k=0

The coefficients are related to unit sample


response as .
bn for 0≤ n≤ M −
h(n) =
0 1
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 Σ− 1


M
y (n) = h(k)x (n −
k)
k=0
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 9 / 94
FIR Filter Design Symmetric and Antisymmetric FIR Filters

Symmetric and Antisymmetric FIR Filters Linear Phase


FIR structure

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


Σ− 1
M
−n
H(z ) =
h(n)z n=0

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 10 / 94
FIR Filter Design Symmetric and Antisymmetric FIR Filters

Symmetry: h(n)=h(M-1-n) Odd M Symmetry: h(n)=h(M-1-n) Even M


h[n] h[n]

-2 -1 0 1 2 3 4

-2 -1 0 1 2 3 4
012345 678 n 0 1 2 3 4 5 6 7 8 n

Center of Symmetry 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]
-2 -1 0 1 2 3 4

-2 -1 0 1 2 3 4
0 1 2 3 4 5 6 7 8 n 0 1 2 3 4 5 6 7 8 n

Center of Symmetry
Center of Symmetry

Figure 4: Symmetric and antisymmetric responses

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)
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 11 / 94
FIR Filter Design Symmetric and Antisymmetric FIR Filters
Frequency response of Linear Phase FIR Filter: Symmetric with M=odd
MΣ− 1
−n
H(z ) = Symmetry: h(n)=h(M-1-n) Odd M
h[n]
h(n)z n=0

Symmetric impulse response with M=odd Then


h(n) = h(M − 1 − n) and (z = e jω )

-2 -1 0 1 2 3 4
. Σ ,
Σ Σ Σ 01234567 8 n
M − M−1 ,
H(z ) = z +
2 (M−3)/2
h(n) z −n + z −( M −1 −n)
1 2
h n=0 Center of Symmetry

M− 3
. Σ ,
M−1
,
Σ2 Σ Σ
H(e jω
)= h M −1 e −jω 2 +
2 h(n) e −jωn + e −jω(M−1−n)
n=0

− j ωn j ω( M −2 1 ) − j ω( 2 M− 1
− n) M− 1
= e M− 1 e
)
= ej ω( 2 . − j ω( 2
)
e− j ωn e − jω ( M − 1) jωn −jω( M− 1
−jω( ) ejωn − j ω( M −2 1 ) − j ω( 2 − n)
e = M −2 1.e) 2 e = .e
M− 1
= e e e
, , Σ , , , , Σ
e− j ω(M − 1−−n)j ωn −jω(M− 1−n) − j ω M −2 1 jω M− 1
−n − j ω M −2 1 − n
e + = e e 2 +
e , , . e Σ
− j ω M −2 1 M −
= e 2cos −n
1 2
ω
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 12 / 94
FIR Filter Design Symmetric and Antisymmetric FIR Filters

M− 3
M −1 M− 1 Σ2

H(e ) = h( −jω( 2 ) + h(n)[e −jωn + e −jω( M−1−n) ]
2 )e n=0
M− 3
. Σ , ,
Σ , , . Σ
M −1 − j ω M 2− 1
2
− j ω M −2 1 M −
= h e + 2cos 1 2 −n
2 h(n)e
n=0 ω

, , . Σ M− 3 
M − Σ2
. M − Σ
− j ω M −2 1 h 
= e  1 2 + 2 h(n)cos 1 2 − n
ω n=0

j ∠H(ω)
H(ω) = |H(ω)|e

M− 3
. Σ Σ . Σ
M − 2
M −
|H(ω)| = h + 2 h(n)cos −n
1 2 1 2
ω n=0

 . Σ
 − M−1
2
for |H(ω)| >
∠H(ω) = . Σ
ω M−1
+ π
0
2
− for |H(ω)| <
Dr. Manjunatha. P (JNNCE) ω UNIT - 7: FIR Filter Design 0 October 25, 2016 13 / 94
FIR Filter Design Symmetric and Antisymmetric FIR Filters

Frequency response of Linear Phase FIR Filter: Symmetric with M=Even



M −1
, ,
 Σ . M −
2
− j ω M −2 1 
H(ω) = e 2 h(n)cos ω − 
1 2 Symmetry: h(n)=h(M-1-n) Even M
Σ n n=0 h[n]

j ∠H(ω)
H(ω) = |H(ω)|e

-2 -1 0 1 2 3 4
2 −1
M
Σ . Σ 0 1 2 3 4 5 6 7 8 n
M −
|H(ω)| = 2 h(n)cos 1 2 −n
ω n=0
Center of Symmetry

.
 M−1 Σ
− 2
for |H(ω)| >
∠H(ω) = . Σ
ω M−1
+ π
0
2
− for |H(ω)| <
ω 0

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 14 / 94
FIR Filter Design Design of linear-phase FIR filters using windows

Design of linear-phase FIR filters using windows

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 15 / 94
FIR Filter Design

Design steps for Linear Phase FIR Filter (Fourier Series


method)
1 Based on the desired frequency response specification Hd (e j ω ) determine the
corresponding unit sample response hd (n).

Σ∞
Hd (ej ω ) = h (n)e − j ωn
d n=0

2 Obtain the impulse response hd (n) for the desired frequency response Hd (ω) by evaluating
the inverse Fourier transform.
∫ π
1 jω jωn
hd (n) = −π
Hd (e )e


3 In general the sample response hd (n) is infinite in duration and must be truncated at some
point to get an FIR filter of length M. Truncation is achieved by multiplying hd (n) by
window function.
h(n) = hd (n)w (n)

where w (n) is window function


4 Obtain the H(z ) for h(n) by taking z transform
5 Obtain the magnitude response |H(e jω )| and phase response θ(ω)|

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 16 / 94
FIR Filter Design

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)

H d ( ) H d ( )

1 1

 
0 p  0 p 
 Low pass Filter High pass Filter

H d ( ) H d ( )

1 1

0 1 2 
 0 1 2  3 4 

Band pass Filter Band stop pass Filter

Figure 5: Frequency response characteristic of different types of filters


Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 17 / 94
FIR Filter Design

Different Types of Windows


Rectangular:
Hanning Hamming:
Blackman:

Bartlett (Triangular) Window


Kaiser window

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 18 / 94
FIR Filter Design Window Design Techniques

Rectangular window
wR (n)

This is the simplest window function


but provides the worst performance
from the viewpoint of stopband 0 1 2 3 4 5 6 M-1
n

attenuation.
The width of main lobe is 4π/N Figure 6: Rectangular window

.
1 for n = 0, 1, M − 1
ωR(n) =
0 otherwise

Magnitude response of rectangular


window is

| sin(ωM
|WR(ω)| = )| 2
ω
| sin( 2 )|

Figure 7: Rectangular window


Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 19 / 94
FIR Filter Design Window Design Techniques

Bartlett (Triangular) Window


wT (n)

n
0 1 2 3 4 5 6 M-1

Figure 8: Bartlett window


Bartlett Window is also Triangular
window.
The width of main lobe is 8π/M

2|n − M −
2
1
ωT (n) = 1 − |
M −
1

Figure 9: Bartlett window

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 20 / 94
FIR Filter Design Window Design Techniques

Hanning window

This is a raised cosine window function given by:


1Σ .
2πn
ΣΣ
w (n) = 1−
2
cos M −
1 Σ Σ
2π 2π
W (ω) ≈ 0.5WR (ω) + 0.25 W R (ω − ) + W (ω + )
R M M

The width of main lobe is: 8πM

wH (n)

n
0 1 2 3 4 5 6 M-1

Figure 10: Hanning window


Figure 11: Hanning window

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 21 / 94
FIR Filter Design Window Design Techniques

Hamming window

This is a modified version of the raised cosine window


Σ . ΣΣ
2πn
w (n) = 0.54 − 0.46
cos M −1
Σ Σ
2π 2π
W (ω) ≈ 0.54WR (ω) + 0.23 W (ω − ) + WR (ω + )
R M M

The width of main lobe is: 8πM

w H (n)

n
0 1 2 3 4 5 6 M-1

Figure 12: Hamming window


Figure 13: Hamming window

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 22 / 94
FIR Filter Design Window Design Techniques

Blackman window
This is a 2nd -order raised cosine window.
Σ Σ . ΣΣ
. 2πn 4πn
w (n) = 0.42 − 0.5 + 0.08
cos M −1 cos M −1

Σ Σ
W (ω) Σ≈ 0.42WR (ω) + 0.25 W (ω −2π ) + R (ω + 2π
M
)
ΣM
W
+0.04 W R (ω −R4π
M
) + WR (ω 4π
M
)
+
The width of main lobe is: 12π
M
wT (n)

n
0 1 2 3 4 5 6 M-1

Figure 14: Blackman window Figure 15: Blackman window

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 23 / 94
FIR Filter Design Window Design Techniques

Kaiser window
This is one of the most useful and optimum windows.
, . ,
. Σ2
I0 β 1 − 1 − 2n
M−1
w (n) =
I 0 (β)
Where I 0 (X ) is the modified zero-order Bessel function, and is a parameter that can be chosen
to yield various transition widths and stop band attenuation. This window can provide different
transition widths for the same N.

β = 0 → rectangularwindow β
= 5.44 → Hammingwindow β
= 8.5 → Blackmanwindow

wH (n)

n
012345 6 M-1

Figure 16: Kaiser


Dr. Manjunatha. P (JNNCE) ww Figurindo 17: KaiserOctober
UNIT - 7: FIR Filter Design e 2016
window25, 24 / 94
FIR Filter Design Window Design Techniques

Table 1: Window and its functions


Window name Window Function
.
1 for 0 ≤ n ≤ M − 1
ωR (n) =
Rectangular
0 otherwise
| −1
2|n− 2M
ω (n) = 1 −
Triangular T M−1
(Bartlet) Σ . ΣΣ
2πn
Hamming Σ . ΣΣ
w (n) = 0.5 − 0.5 cos 2πn
N−1
Hanning Σ . Σ .
ΣΣ
2πn
Blackman
w (n) = 0.42 − 0.5 cos 4πn
N−1 + 0.08 cos N−1

Table 2: Summary of window function characteristics


Window Transition Min. stopband Peak value
name width of main attenuation of side lobe
lobe

Rectangular M+1 -21 dB -21 dB

Hanning M -44 dB -31 dB

Hamming M -53 dB -41 dB

Bartlett M -25 dB -25 dB
12π
Blackman M -74 dB -57 dB
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 25 / 94
FIR Filter Design Window Design
Techniques

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 .

Figure 19: LPF designed with Hamming,


Figure 18: LPF designed with Hanning and Blackman window M=61
rectangular window M=61 and 101
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 26 / 94
FIR Filter Design Low Pass FIR
Filter Design

Design a LPFπusing rectangular window for the desired frequency response of a low pass filter
given by ωc = 2
rad/sec, and take M= 11. Find the values of h(n). Also plot the magnitude
response
.
Solution:
H (e j )
e 1 d
 − j ωτ − ω ≤ ω ≤ ω
jω c c
Hd (e ) = − π ≤ ω ≤ −ωc
0  0
ωc ≤ ω ≤ π 
  0  
M −1 
2
τ = = 5 2
2
. Figure 20: Frequency response of LPF
jω e− j ωτ
Hd(e ) = − ωc ≤ ω ≤ ωc
0 Otherwise
By taking inverse Fourier transform
Σ Σωc
∫ 1e jω( n−τ )
1 π
jω jωn hd (n) =
hd (n) = Hd (e )e 2π j(n − τ ) − ω
2π −π c
dω ∫ ωc 1 Σ Σ
1 ejω c( n− τ ) − − j ω c(n−τ )
= e− j ω τ ejωn =
2jπ(n −
2π dω Σ e Σ
−ω c
∫ ωc τ) jω c (n−τ ) − − j ωc ( n−τ )
1 1
= ejω( n−τ )
=
2π e
π(n − e2j
−ω c dω
τ)
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 27 / 94
FIR Filter Design Low Pass FIR Filter Design

sin [ωc (n −
hd(n) =
τ )]π(n − sin π (2− 5)
hd(2) = 2
= −0.106
τ) π(2 − 5)
for n ƒ= 5 and ωc = π2 , τ = M 2− 1 = π (3− 5)
5 sin 2
Σ Σ hd (3) = = 0
π (n− 5) π(3 − 5)
sin [ωc (n − sin 2
hd(n) = = = sin π(4−5) = .318
5)] π(n − 5) π(n − hd (4)
2

5) π(4 − 5)
0
for n=5 hd (n) = 0 . Using L Hospital’s Rule hd (5) = sin π(5−5)
2 = .5
π(5 − 5)
sin Bθ
lim = sin π(6−5)
θ→ 0 B hd (6) = 2 = .318
θ π(6 − 5)
π
sin (n
2
− 5) π/2 = sin π(7−5)
2 = 0.0
lim = = 0.5 hd (7)
n→5 π(n − 5) π π(7 − 5)

where π = 3.1416 sin π(8−5)


hd (8) = π(8 − 5) = −.106
2

sin π (0−
5)
2
hd(0) = = 0.0637 sin π(9−5)
2 = 0
π(0 − 5) hd (9) =
π(9 − 5)
sin π (1−
2
5)
hd(1) = = 0 hd (10) = sin π(10−5)
2 = .063
π(1 − 5)
π(10 − 5)
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 28 / 94
FIR Filter Design Low Pass FIR Filter Design
The given window is rectangular window
.
1 for 0 ≤ n ≤ 10
ω(n) =
0 Otherwise
This is rectangular window of length M=11. h(n) = hd (n)ω(n) = hd (n) for 0 ≤ n ≤ 10
Σ− 1
M Σ10
H (z ) = h(n)z− n = −n

h(n)z n=0 n=0

The impulse response is symmetric with M=odd=11


M− 3
. Σ Σ2
H(z ) = h M −1 z M2− 3 + h(n)[z −n + z (M−1 −n) ]
2 n=0
−5 −0
= h(5)z + h(0)[z + z −10 ] + h(1)[z −1
+ z −9
] + h(2)[z −2
+ z −8]
+
−3
= +h(3)[z + z − 7 ] + h(4)[z −4
+ z −6]
M− 3
Σ . Σ
.
2
M −
ω
|H(e j)| = h M−1 + 2 h(n)cos −n
1 2
Σ ω n=0
2
Σ4
= 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
= Pω(JNNCE)
Dr. Manjunatha. UNIT - 7: FIR Filter Design October 25, 2016 29 / 94
FIR Filter Design Low Pass FIR Filter Design


|H(e )| = 0.5 + 0.127cos 5ω − 0.212cos 3ω + 0.636cos
ω
|H(e jω )|dB = 20log |H(e jω )| 10

ω |H(e jω )| |H(e j ω )|dB


0 1.0151 -0.44 −10

0.1π 0.9808 -0.17

dB
−20
0.2π 0.9535 -0.41

|H(ejw)|
0.3π 1.0758 0.63 −30

0.4π 0.9952 -0.04


0.5π 0.5 -6.02 −40

0.6π 0.0048 -46.37


−50
0.7π 0.0758 -22.41
0.8π 0.0467 -26.65 −60
0 0.5 1 1.5 2 2.5 3 3.5
0.9π 0.0192 -34.35 , 0 to  in radians
1.0π 0.0512 -25.74
Figure 21: Frequency response of LPF

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 30 / 94
FIR Filter Design

Low Pass FIR Filter Design


.
The desired frequency response j ωlow passe−
of filter − 3π
j 3ω is given 4by
≤ ω 3π
4
Hd (e ) = ≤3π ≤ |ω| ≤
0 4
π
Determine the frequency response of the FIR if Hamming window is used with N=7 June-2015,
Dec-2014, June-2012
Solution:
M − 1
τ= = 3
2

∫ π
1 jω jωn
hd (n) = H (e )e
2π − π d H (e j )
∫ ωc dω 1 d

1
= e− j ω τ ejωn

∫ ωc dω
−ω c

=
1
ejω( n−τ )  3 3 

2π  0
4 4
Σ−ω c dω Σωc
1 e jω( n−τ )
=
2π j(n − τ ) −ω
Σ
c
Σ sinωc (n −
jω c(n− τ ) − − j ω c( n−τ ) hd(n) =
1 τ )π(n −
=
π(n e− e τ)
τ) 2j
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 31 / 94
FIR Filter Design Low Pass FIR Filter Design

. Σ
3π (0− 3)
sin 4
hd (0) = = 0.075
π(0 − 3)
. Σ
3π (1− 3)
sin 4
hd (1) = = −0.159
π(1 − 3)
M−1 . Σ
n ƒ= 3 ω
c = 3π τ = = 3π (2− 3)
4 2 sin
3 4
= 0.225
Σ Σ hd (2) =
3π (n− 3) π(2 − 3)
sin 4 . Σ
hd(n) = 3π (3− 3)
sin
π(n − 3) 4
hd (3) = = 0.75
π(3 − 3)
0
. Σ
for n=3 hd (n) = 0. Using L Hospital’s Rule sin
3π (4− 3)
4
Σ hd (4) = = 0.225
sin Σ3π (n π(4 − 3)
lim 4 − 3) = 3π/4 = . Σ
n→ 3 π(n − 3) 0.75 sin 3π (5−
4
3)

π hd (5) = = −0.159
π(5 − 3)
. Σ
sin 3π (6−
3)
4
hd (6) = = 0.075
π(6 − 3)

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 32 / 94
FIR Filter Design Low Pass FIR Filter Design

The given window is Hamming window

. Σ
2πn
w (n) = 0.54 − 0.46cos
M − To calculate the value of h(n)
. 1Σ
0.54 − 0.46cos 0
ω(0) = = 0.08 h(n) = hd (n)w (n)
6 Σ
.

ω(1) = = .31
0.54 − 0.46cos 6
Σ h(0) = hd (0)w (0) = 0.075 × 0.08 =
ω(2) = . 4π = .77 h(1) = 0.006
6 hd (1)w (1) = −0.159 × 0.31 =
0.54 − 0.46cos Σ h(2) = −0.049
h d (2)w (2) = 0.225 × 0.77 = 0.173
. 6π
ω(3) = = 1 h(3) =
0.54 − 0.46cos 6 hd (3)w (3) = 0.750 × 1 = 0.750
Σ h(4) =
ω(4) = . 8π hd (4)w (4) = 0.225 × 0.77 = 0.173
0.54 − 0.46cos = 0.77
Σ
h(5) = hd (5)w (5) = −0.159 × 0.31 = −0.049
6
. 10π h(6)
ω(5) = = .31 = hd (6)w (6) = 0.075 × 0.08 = 0.006
0.54 − 0.46cos 6
Σ
ω(6) = . 12π
= .08
0.54 − 0.46cos 6

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 33 / 94
FIR Filter Design Low Pass FIR Filter Design
The frequency response is symmetric with M=odd=7
M− 3
Σ2 . Σ
. M −

|H(e )| = h M−1 + 2 h(n)cos −n
1 2
Σ ω n=0
2
Σ2
= h(3) + 2 h(n)cos ω(3 − n) = h(3) + 2h(0)cos 3ω + 2h(1)cos 2ω + 2h(2)cos
ω
= 0.75 + 0.012cos
n=0 3ω − 0.098cos 2ω + 0.346cos
ω
|H(e jω )|dB = 20log |H(e jω )| 2

ω |H(e jω )| |H(e j ω )|dB


0 1.0100 0.0864 −2

0.1π 1.0068 0.0592

dB
−4
0.2π 0.9959 -0.0354
|H(ejw)|
0.3π 1.9722 -0.2445 −6

0.4π 0.9265 -0.6631


0.5π 0.8480 -1.4321 −8

0.6π 0.7321 -2.7089


−10
0.7π 0.5883 -4.6077
0.8π 0.4435 -7.0620 −12
0 0.5 1 1.5 2 2.5 3 3.5
0.9π 0.3346 -9.5095 , 0 to  in radians
1.0π 0.2940 -10.6331
Figure 22: Frequency response of LPF
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 34 / 94
FIR Filter Design Low Pass FIR Filter Design

Matlab code
c l c ; cl ea r a l l ; close a l l ;
M= inpu t(’e nte r t h e v a l u e o f M:’);
omega= inpu t(’e nt er t h e v a l u e o f omega:’);
ta u= (M -1)/2 ;
f o r n=0:M-1;
c(n+1)=.5-.5*cos((2*pi*n)/(M-1));
c ( n + 1 ) = . 5 4 - .4 6 * c o s ( ( 2 * p i * n ) / ( M - 1 ) ) ;
i f n==tau
h(n+ 1)= om e ga/pi ;
else
h(n+1)=sin(ome ga *( n- ta u) ) /(pi*( n- ta u ) ) ;
end
end
h

c
fo
r
n=
1:
M
y=h(n)*c(n)
’end
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 35 / 94
FIR Filter Design Low Pass FIR Filter Design

c l c ; cl ea r a l l ; close a l l ;
r a n ge = 0 ;
M= inpu t(’e nte r t h e v a l u e
o f M:’);
f o r omega=0:.1*pi:pi
ran ge= ra nge + 1;
H_omega= abs(0.75+. 0
12*cos(3*omega)-.098
*cos(2*omega)
+. 346*cos(omega));
H_omega=abs(0.25+ . 45*cos(omega)+ . 318*cos(2*omega));
H_indB(range)=20*log10(H_omega)
end
omega= 0:. 1*pi: p i
; i=1:range;
plot(omega,
H_indB(i),’linewi
dth’,2 )
xlabel(’\omega, 0 t o \ p i i n radians’,’fontsize’,13)
ylabel(’ |H(e^{jw})|_{dB}’,’fontsize’,13)

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 36 / 94
FIR Filter Design Low Pass FIR Filter Design
Determine the filter coefficients hd (n) for the desired frequency response of a low pass filter
given by .
jω e− 2j ω for − 4π ≤ ω π4
Hd (e ) = ≤
0 for π4 ≤ |ω| ≤
−π
If we define the new filter coefficients by hd (n) = hd (n)ω(n) where
.
1 for 0 ≤ n ≤ 4
ω(n) =
0 otherwise

Determine h(n) and also the frequency response H(e j ω ) July-2013, July-2011
Solution:
∫ π H (e j )
1 1 d
hd (n) = Hd (e j ω )ejωn dω
2π −π
∫ π /4
1
= e−j2ω ejωn 
2π − π /4   0  
dω 
4 4
∫ π/4
1
= ej ω(n− 2) d
2π − π /4 ω
Σ Σπ / 4 Σ π Σ
1e j ω(n− 2) 1 π
= hd (n) = ej (n−2)
4
− − j 4(n−2)
2π j(n − 2) 2jπ(n − 2) e
−π/4 Σ π π Σ
1 j 4 (n−2)
− − j 4(n−2)
=
e
π(n − 2) e2j

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 37 / 94
FIR Filter Design Low Pass FIR Filter Design

The given window function is


.
1 for 0 ≤ n ≤ 4
n ƒ= ω(n) =
0 Otherwise
2
hd (n) = sin π(n−2)
4

π(n − 2) This is rectangular window of length M=5.


0
In this case h(n) = hd (n) for 0 ≤ n ≤ 4
for n=2 h d(n) = 0. Using L Hospital’s Rule

π n hd (n) n hd (n)
sin (n
4
− 2) π/4
lim = = 0 0.159091 3 0.224989
n→ 2 π(n − 2) 0.25 1 0.224989 4 0.159091
π 2 0.25

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 38 / 94
FIR Filter Design Low Pass FIR Filter Design
The frequency response is symmetric with M=odd=5
M− 3
Σ2 . Σ
. M −

|H(e )| = h M−1 + 2 h(n)cos −n
1 2
Σ ω n=0
2
Σ1
= h(2) + 2 h (2 − n) cos ωn = h(2) + 2h(0)cos 2ω + 2h(1)cos
ω
= 0.25 + 0.318cos
n=0 2ω + 0.45cos
ω

|H(e jω )|dB = 20log |H(e jω )| 10

ω |H(e jω )| |H(e j ω )|dB


0 1.0180 0.1550 −10

0.1π 0.9352 -0.5815

dB
−20
0.2π 0.7123 -2.9464
|H(ejw)|
0.3π 0.4162 -7.6132 −30

0.4π 0.1318 -17.6023


0.5π 0.0680 -23.3498 −40

0.6π 0.1463 -16.6936


−50
0.7π 0.1128 -18.9561
0.8π 0.0158 -36.0322 −60
0 0.5 1 1.5 2 2.5 3 3.5
0.9π 0.0793 -22.0154 , 0 to  in radians
1.0π 0.1180 -18.5624
Figure 23: Frequency response of LPF
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 39 / 94
FIR Filter Design Low Pass FIR Filter Design

Design the symmetric FIR lowpass filter whose desired frequency response is given as
. − j ωτ
Hd (ω) = e for |ω| ≤ ωc
0 Otherwise

The length of the filter should be 7 and ωc = 1 radians/sample. Use rectangular window.

Solution:
Desired frequency response Hd (ω)
H (e j )
Length of the filter M =7 1 d

Cut-off frequency ωc = 1 radians/sample. Unit


sample response is ∫ π
1 defined as 
jω jωn 1
hd (n) = Hd (e )e  1 0

2π − π

Given Hd (ω) is
Figure 24: Frequency response of
LPF
.
e− ωτ for − 1 ≤ ω ≤ 1
Hd (ω) = 0 Otherwise

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 40 / 94
FIR Filter Design Low Pass FIR Filter Design

∫ 1 Determine the value of τ


1
hd (n) = e− ω τ ejωn
2π − 1 dω M −1
∫ τ= = 3
1 1 2
jω( n−τ )
= e d ,
2π −1 ω
sin(n− 3)
for n ƒ =
Σ Σ1 hd (n) = π (n− 3)
1 τ
= e ω(n−τ ) π
1
2π j(n − τ ) for n = τ
−1 This is rectangular window of length M=7.
In this case h(n) = hd (n).w (n) = hd (n)
= sin(n − τ )
π(n − for n ƒ = τ
τ) n h(n) n h(n)
for n = τ hd (n) = 0 .0Using L Hospital’s 0 0.015 4 0.2678
Rule 1 0.1447 5 0.14472
sin(n − τ ) 1
lim = 2 0.2678 6 0.15
n→τ π(n − τ ) 3 0.3183

Thus hd (n) πis This is the unit sample response of required


, FIR filter. The filter is symmetric and satis-
sin(n−τ )
for n =ƒ τ
hd (n) = π(n−τ ) fies h(n) = h(M − 1 − n)
π
1
for n = τ

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 41 / 94
FIR Filter Design Low Pass FIR Filter Design
Design the FIR filter using Hanning window
Solution:For M = 7

2πn
ω(n) = 0.5(1 − cos )
M − 1
2πn
ω(n) = 0.5(1 − cos )
6 To calculate the value of h(n)

h(n) = hd (n)w (n)

ω(0) = 0.0
2π h(0) = hd (0)w (0) = 0.01497 × 0 = 0
ω(1) = 0.5(1 − cos ) = .
6 h(1) = hd (1)w (1) = 0.014472 × 0.25 =
25
4π 0.03618
ω(2) = 0.5(1 − cos ) = . h(2) = hd (2)w (2) = 0.26785 × 0.75 = 0.20089
75 6
6π h(3) = hd (3)w (3) = 0.31831 × 1 = 0.31831
ω(3) =
0.5(1 − cos ) = 1 hd (4)w (4) = 0.26785 × 0.75 = 0.20089
h(4) =
6
h(5) = hd (5)w (5) = 0.14472 × 0.25 = 0.03618
ω(4) = 0.5(1 − cos8π ) = .
75 6 h(6) = hd (6)w (6) = 0.014497 × 0.0 = 0
10π
ω(5) =
0.5(1 − cos ) = .25
6
12π
ω(6) =
0.5(1 − cos ) = 0
6
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 42 / 94
FIR Filter Design Low Pass FIR Filter Design

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
H (e j )
As = 50 dB for ωs = 45πrad/sec 1 d

ω= Ω F
sf

Ω1 30π
ω1 = = = 0.3π 
rad/sampleFsf 100  0.3 0.3 
0
Ω2 45π
ω2 = = = 0.45π Figure 25: Frequency response of LPF
rad/sampleFsf 100

3 dB attenuation at ω1= 0.3π rad/sample


50 dB attenuation at ω2 = 0.45π rad/sample

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 43 / 94
FIR Filter Design Low Pass FIR Filter Design

Type of window is
The stopband attenuation of 50 dB is .
provided by the Hamming window e− j ωτ for − ω c≤ ω ≤ ω c
Hd (ω) = 0 Otherwise
which of -53 dB. Hence Hamming win-
dow is selected for the given specifica-
tions. τ = (M − 1)/2 = 55 − 1/2 =
To determine the order of the filter 27
ωc = 0.3π
The width of the main lobe in Ham- ∫
1 ωc
ming window is 8πM e− j ω τ ejωn
hd (n) = 2π dω
−ω c
k 2π = 1
∫ 0.3π

M = ej ω(n− 27)
M 2π − 0.3π dω
8π Σ Σ0.3π
M = 1 ω(n− 27)
ω2 − ω1 = e
2π j(n − 27)
The order of the filter M is: −0.3π

= sin[ωc (n − 27)] for n ƒ = 27



M= = 53.33 π(n − 27)
0.45π −
0.3π when n = 27
Assume linear phase FIR filter of odd
length Hence select next odd integer ωc
hd (n) = =
length of 55. 0.3 π

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 44 / 94
FIR Filter Design Low Pass FIR Filter Design

n h(n) n h(n)
The selected window is Hamming M=27 0 0.0 28 0.2567
1 0.0 29 0.1495
2 -0.0012 30 0.0319
. Σ 3 0.0 31 -0.0445
2πn 4 0.0 32 -0.0588
w (n) = 0.54 − 0.46cos 5 0.0021 33 - 0.0278
M − 6 0.0023 34 0.012
. πn
1 Σ 7 0.0 35 0.0308
= 0.54 − 0.46cos 8 -0.0036 36 0.0220
18 9 -0.0052 37 -0.0
10 -0.0021 38 -0.0157
The value of h(n) 11 0.0048 39 -0.0156
12 0.0098 40 -0.0043
13 0.0069 41 0.0069
h(n) = hd (n)w (n) 14 -0.0043 42 0.0098
15 -0.0156 43 0.0048
16 -0.0157 44 -0.0021
for M = 27 17 0.0 45 -0.0052
18 0.0220 46 -0.0036
sin[0.3π(n − Σ . πn 19 -0.0308 47 0.0
h(n) = 0.54 − ΣΣ 20 -0.0120 48 0.0023
27)]π(n − 27) 18 21 -0.0278 49 0.0021
0.46cos 22 -0.0588 50 0.0
23 -0.0445 51 0.0
for n =ƒ 27 24 0.0319 52 -0.0012
25 0.1495 53 0.0
Σ . πn 26 0.2567 54 0.0
h(n) = 0.3 0.54 − ΣΣ 27 0.3
0.46cos 18

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 45 / 94
FIR Filter Design Low Pass FIR Filter Design

An analog signal contains frequencies upto 10 KHz. The signal is sampled at 50 KHz. Design
an FIR filter having linear phase characteristic and transition band of 5 KHz. The filter should
provide minimum 50 dB attenuation at the end of transition band.

Solution:
3 dB cut-off at 30 π rad/sec
Ωp = 2π × 10 × 103rad/sec
Ωs = 2π × (10 + 5) × 103rad/sec
Sampling frequency FSF = 100 Hz
Stopband attenuation of 50 dB at
H (e j )
45 π rad/sec
A = 50 dB for ω = 45πrad/sec 1 d
s s
ω= Ω
Fsf


Ωp = 2π × 10 × 10 =
3
=  
ωp Fsf 50 × 103 0.5 0 0.5
0.4π
2π × (10 + 5) × Figure 26: Frequency response of LPF
= Ωs = =
ωs Fsf 103 50 × 103
0.6π

ωp = 0.4π rad/sample
ωs = 0.6π rad/sample

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 46 / 94
FIR Filter Design Low Pass FIR Filter Design

Type of window is .
The stopband attenuation of 50 dB is e− j ωτ
Hd (ω) = for − ωc ≤ ω ≤ ωc
provided by the Hamming window 0 Otherwise
which of -53 dB. Hence Hamming win-
dow is selected for the given specifica- τ = (M − 1)/2 = 41 − 1/2 =
tions. 20
To determine the order of the filter ωc = ω p + ∆ ω
2 = 0.4π + 0.2π
ωc= 0.5π 2
The width of the main lobe in Ham-

ming window is 8πM 1 ωc
hd (n) = e −jωτ e jωn dω
2π 2π
−ω c
∫ 0.5π
8π 1
k = ej ω(n− 20) d
= 8π 2π − 0.5π ω
M≥ M Σ Σ0.5π
ω(n− 27)
ωs− ω 1
=
M p e
2π j(n − 20) −0.5π
The order of the filter M is:

8π = sin[ωc (n − 20)]
π(n − 20) for n ƒ = 20
M ≥ ≥ 40
0.6π − 0.4π
when n = 20
Assume linear phase FIR filter of odd
length Hence select next odd integer
hd (n) = ωc = 0.5π =
length of 41.
0.5 π
π

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 47 / 94
FIR Filter Design Low Pass FIR Filter Design

n h(n) n h(n)
The selected window is Hamming M=41
0 0.0 21 0.3148
1 -0.00146 22 0.0
. Σ 2 0.0 23 -0.1
2πn
w (n) =0.54 − 3 -0.00247 24 0.0
0.46cos . M −Σ 4 0 25 0.055
1
2πn 5 -0.00451 26 0.0
40 6 0.0 27 -0.0337
= 0.54 − 0.46cos
7 0.0079 28 0.0
The value of h(n) 8 0.0 29 0.0213
9 -0.0136 30 0.0
h(n) = hd (n)w (n) 10 0.0 31 -0.0136
11 0.002135 32 0.0
12 0.0 33 0.0079
for M = 41 n ƒ = 20
13 -0.03375 34 0
Σ . ΣΣ 14 0.0 35 -0.0045
sin[0.5π(n − 20)] 2πn
h(n) = 0.54 − 15 0.05504 36 0.0
π(n − 20) 0.46cos 20 16 0.0 37 0.0024
17 -0.1006 38 0.0
for n = 20 18 0.0 39 -0.0014
Σ . ΣΣ 19 0.3148 40 0.0
2πn 20 0.5
h(n) = 0.5 0.54 −
0.46cos 20

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 48 / 94
FIR Filter Design Low Pass FIR
Filter Design

Design an FIR filter (lowpass) using rectangular window with passband gain of 0 dB, cutoff
frequency of 200 Hz, sampling frequency of 1 kHz. Assume the length of the impulse response
as 7.
Solution:
fFcc== FF200
c 200
= 0.2cycles/sample
Hz,
s 1000 Fs = 1000 Hz, H (e j )
ωc = 2π ∗ fc = 2π × 0.2 = 0.4πrad
1 d
M=7

.
e− j ωτ

Hd (ω) = for − ωc ≤ ω ≤ ωc  0.4 0.4 
0 Otherwise 0

Figure 27: Frequency response of LPF


τ = (M − 1)/2 = 7 − 1/2 = 3
ωc = 0.4π
∫ when n ƒ = 3
1 ωc
hd (n) = e −jωτ ejωndω sin[0.4π(n − 3)]

−ω c hd(n) =

1 0.4π π(n − 3)
= e jω(n−3) dω
2π − 0.4π
Σ Σ0.4π when n = 3
1 e ω(n− 3)
= 0.4
2π j(n − 3) hd (n) = π =
− 0.4π
π
0.4
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 49 / 94
FIR Filter Design Low Pass FIR Filter Design

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

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 50 / 94
FIR Filter Design Low Pass FIR Filter Design

Using rectangular window design a lowpass filter with passband gain of unity, cutoff frequency of
1000 Hz, sampling frequency of 5 kHz. The length of the impulse response should be 7.
DEC:2013,DEC:2012

Solution:
Fc = 1000 Hz, Fs = 5000 Hz,
fc = FFcs1000
5000= 0.2cycles/sample
ωc = 2πfc = 2 × π × 0.2 = 0.4πrad
M=7
The filter specifications (ωc and M = 7 ) are similar to the previous example. Hence same filter coefficients are
obtained.
h(0)=-0.062341, h(1)=0.093511, h(2)=0.302609
h(3)=0.4, h(4)=0.302609, h(5)=0.093511, h(6)=-0.062341

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 51 / 94
FIR Filter Design Low Pass FIR
Filter Design

Design a normalized linear phase FIR low pass filter having phase delay of τ = 4 and at least 40
dB attenuation in the stopband. Also obtain the magnitude/frequency response of the filter.

Solution: The linear phase FIR filter is nor- H (e j )


malized means its cut-off frequency is of ωc = 1 d

1rad/sample
The length of the filter with given τ is related by
M −1 
τ=
2  1 0 1

For τ = 4 M = 9
Desired unit sample response hd (n) is
Figure 28: Frequency response
of LPF
∫ ωc when n ƒ = 4
1
hd (n) = e− j ω τ ejωn
2π − ωc dω
∫1 sin[(n − 4)]
1 hd (n) =
= ej ω(n− 4) d π(n − 4)
2π −1 ω
Σ Σ1 when n = 4
1 e ω(n− 4)
= ∫
2π j(n − 4) −1 1 1 ω
hd (n) = 1 −1
1dω = =
2π π π

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 52 / 94
FIR Filter Design Low Pass FIR Filter Design

for n = 0 to 8
Σ . ΣΣ
h(n) = hd (n)w (n) sin(0 − 4) π0
h(0) = 0.5 − 0.5cos = 0.0000
π(0 − 4) 4
The stopband attenuation required for Σ . ΣΣ
sin(1 − 4) π1
this filter is 40 dB. From the table the h(1) = 0.5 − 0.5cos = 0.0022
Hanning window satisfies this require- π(1 − 4) 4
ment. The Hanning window function Σ . ΣΣ
sin(2 − 4) 2π
given by: h(2) = 0.5 − 0.5cos = 0.0724
π(2 − 4) 4
Σ .
sin(3 − 4) ΣΣ3π
. Σ h(3) = = 0.2286
2πn π(3 − 4) 0.5 −
w (n) = 0.5 − Σ 0.5cos 4
M − sin(4 − 4)
0.5cos
1 h(4) = . 4π = 0.3183
π(4 − 4) ΣΣ4
Σ ΣΣ
for n ƒ = 4 and M = 9 sin(5 − 4) 0.5 − 0.5cos 5π
h(5) = = 0.2286
Σ . πn π(5 − 4)
h(n) = sin(n − 4) 0.5 − ΣΣ
.
ΣΣ
π(n − 4) 0.5cos 4 sin(6 − 4) 0.5 − 0.5cos 4
h(6) = = 0.0724
π(6 − 4) Σ . 6π
for n = 4 sin(7 − 4) 0.5 − 0.5cos
Σ . ΣΣ h(7) = = 0.0022
π4 π(7 − 4) Σ . 4
h(n) = 1 0.5 − = 1 ΣΣ
0.5cos 4 π sin(8 − 4) 0.5 − 0.5cos 7π
h(8) = = 0.0000
π π(8 − 4) Σ .
0.5 − 0.5cos 4

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25,ΣΣ
2016 53 / 94
FIR Filter Design Low Pass FIR Filter Design
The frequency response is symmetric with M=odd=9
M− 3
Σ2 . Σ
. M −

|H(e )| = h M−1 + 2 − n cos ω
1 2
Σ h n=0
2
Σ3
= h(4) + 2 h(n)cos ω (4 −
n)
= h(4) + 2h(0)cos
n=0 4ω + 2h(1)cos 3ω + 2h(2)cos 2ω + 2h(3)cos
ω
= 0.3183 + 0.044cos 3ω + 0.1448cos 2ω + 0.4572cos ω
|H(e jω )|dB = 20log |H(e jω )| 10

ω |H(e jω )| |H(e j ω )|dB


0 1.0180 0.1550 −10

0.1π 0.9352 -0.5815

dB
−20
0.2π 0.7123 -2.9464
0.3π 0.4162 -7.6132 |H(ejw)| −30

0.4π 0.1318 -17.6023


0.5π 0.0680 -23.3498 −40

0.6π 0.1463 -16.6936


−50
0.7π 0.1128 -18.9561
0.8π 0.0158 -36.0322 −60
0 0.5 1 1.5 2 2.5 3 3.5
0.9π 0.0793 -22.0154 , 0 to  in radians
1.0π 0.1180 -18.5624
Figure 29: Frequency response of LPF
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 54 / 94
FIR Filter Design High Pass FIR Filter Design

Design a HPF using Hamming window. Given that cutoff frequency the filter coefficients hd (n)
for the desired frequency response of a low pass filter given by ωc = 1rad/sec, and take M = 7 . Also plot the
magnitude response.
Solution:  e− j ωτ − π ≤ ω≤
−ω
jω  c
Hd (e ) = e − j ω τ ωc ≤ ω ≤ −π
 0
− ωc ≤ ω ≤ ωc
M −1
τ = = 3
2
.
e− j ω τ
H d(e )j ω= − π ≤ −ω ≤ ωc
0 Otherwise
H d(e j )
1
∫ π
1 jω jωn
hd (n) = Hd (e )e
2π −π c c

∫ − ωdω ∫ π 0  
1 c
jω(n−τ ) jω(n− τ )
= [ dω + d
2π e − π e ω
ωc
Σ Σ− ωc Σ Σπ
1e jω( n−τ ) 1e jω(n−τ )
= +
2π j(n − τ ) − π 2π j(n − τ ) ω
c
Σ Σ
1 − j ω c(n−τ ) − e− j π ( n − τ ) + − jω c(n −τ )
= jπ(n−τ )
e
π(n − e 2j e
τ)
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 55 / 94
FIR Filter Design High Pass FIR Filter Design

Σ Σ ΣΣ
jπ(n−τ ) − −jπ(n−τ ) − e jωc ( n−τ ) − − j ω c(n−τ )
hd (n) = 1 e
π(n − τ ) e 2j e
1 [sinπ(n − τ ) − sinωc (n − τ ]
=
π(n − τ )

τ = 3 ωc = 1 hd (n) = π (n− 3) [sinπ(n − 3) − sin(n −


1

when n = τ using L Hospital rule3)]


Σ Σ
1 sinπ(n − 3) sinωc (n − 3) 1 1
hd(n) = − = [π − ωc ] = [π −
π (n − 3) 1] (n − 3) π
π
The given window function is Hamming window. In this case h(n) = hd (n)ω(n)) for 0 ≤ n ≤ 6
. Σ
2πn
w (n) = 0.54 −
0.46cos M −
1Σ . ΣΣ
1 2πn
h(n) = [sinπ(n − 3) − sin(n − 3)] × 0.54 −
π(n − 3) 0.46cos M −
1
n h(n) n h(n)
0 -0.00119 4 -0.00119
1 -0.00448 5 -0.00448
2 -0.2062 6 -0.2062
3 0.6816

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 56 / 94
FIR Filter Design High Pass FIR Filter Design

The magnitude response of a symmetric FIR filter with M=odd is


(M − 3)
Σ . Σ
.
2
M −

|H(e )| = h M−1 + 2 −n
1 2
Σ h(n)cosω
n=0
2
For M = 7

jω Σ2
|H(e )| = h (3) + 2 h(n)cosω(3 −
n) n=0
h (3) + 2h(0)cos3ω + 2h(1)cos2ω + 2h(2)cosω
=
0.6816 − 0.000238cos3ω − 0.0896cos2ω −
= 0.4214cosω

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 57 / 94
FIR Filter Design Band Pass FIR Filter Design
Design the bandpass linear phase FIR filter having cut off frequencies of ωc1 = 1rad/sample and
ωc2 = 2rad/sample. Obtain the unit sample response through following window.
.
1 for 0 ≤ n ≤ 6
ω(n) =
0 Otherwise

Solution:
H d(e j )
. 1
e− j ωτ ωc1≤ |ω | c≤ ω c2
Hd (ω) = 0 Otherwise
 c2 c1 0 c 2  
c1
∫ π
1 j ωn
hd (n) = Hd (ω)e
2π −π
Σ∫ dω Σ
− ωc1 ∫ ωc2
1 − j ω τ jωn − j ω τ jωn
= e e dω + e
2π e dω
−ωc 2 ωc1
Σ∫ ∫ Σ
1 − ωc1 ωc2
= ejω(n−τ )
jω(n−τ )
+ e
2π dω
−ω c 2 ωc1
Σ Σ −ω c Σ Σω c 
= 1 e jω(n−τ ) 1
+ e jω(n−τ ) 2

2π (n − τ ) −ω c 2 (n − τ ω c1
)
= sinωc2 (n − τ ) − sinωc1 (n − τ )
π(n − for n ƒ = τ
τ)
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 58 / 94
FIR Filter Design Band Pass FIR Filter Design

hd(n) = sinωc2 (n − τ ) − sinωc1 (n − τ )


π(n − τ )

= ωc2 − ωc1 for n = τ


π

, sinωc2(n−τ )−sinω ( n−τ )


c1 π( n − τ )
for n ƒ =
hd (n) =
n τ= τ
ω −ω
c2
π
c1 for
n h(n) n h(n)
The linear phase FIR filter is normalized means its
0 -0.044 4 0.0215
cut-off frequency is of ωc = 1rad/sample 1 -0.165 5 0.265
The length of the filter with given τ is related by 2 0.215 6 -0.044
M −1 7− 1 3 0.3183
τ= = = 3
2 2

and ωc2 = 2 rad/sample ωc = 1rad/sample


,
sin2(n− 3)− sin(n− 3)
π(n−τ )
for n =ƒ 3
hd (n) = 1
π
for n = 3 for

The given window is rectangular hence

h(n) = hd (n)w (n) = hd (n)


Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 59 / 94
FIR Filter Design Band Pass FIR Filter Design

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

M− 3
Σ . Σ
.
2
M −
H(ω) = h M−1 + 2 h(n)cos −n
1 2
Σ ω n=0
2
Σ2
H(ω) = h(3) + 2 h(n)cos ω (n − 3)
n=0

Estimate the H(ω) by substituting the required values in the above equation.

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 60 / 94
FIR Filter Design

Band Pass FIR Filter Design


π 3π
Design an ideal bandpass filter having frequency
H d e (jω)
≤ |ω|
for response
≤ 4
Use rectangular window with N=11 in your design 4

Solution:
H d(e j )
. 1
e− j ωτ c1 ≤ |ω c| ≤ c2
Hd (ω) = ω
0 ω
Otherwise
 c2 c1 0 c 2  
c1
∫ π
1 j ωn
hd (n) = Hd (ω)e
2π −π
Σ∫ dω Σ
− ωc1 ∫ ωc2
1 − j ω τ jωn − j ω τ jωn
= e e dω + e
2π e dω
−ωc 2 ωc1
Σ∫ ∫ Σ
1 − ωc1 ωc2
= ejω(n−τ )
jω(n−τ )
+ e
2π dω
−ω c 2 ωc1

Σ Σ −ω c Σ Σω c 
= 1 e jω(n−τ ) 1
+ e jω(n−τ ) 2 

2π (n − τ ) −ω c 2 (n − τ ω c1
)
= sinωc2 (n − τ ) − sinωc1 (n − τ ) =ƒ
π(n − for n
τ
Dr. Manjunatha. P (JNNCE) τ )- 7: FIR Filter
UNIT Design October 25, 2016 61 / 94
FIR Filter Design Band Pass FIR Filter Design

hd(n) = sinωc2 (n − τ ) − sinωc1 (n − τ )


π(n − τ )

= ωc2 − ωc1 for n = τ


π
, sinωc2( n− τ )−sinω ( n−τ )
c1 π(n−τ )
for n ƒ =
hd (n) = ω −ω τ
c2
π
c1 for n = τ for
The length of the filter with given τ is related by

M −1 11 − 1
τ= = = 5
2

 Σ 3π (n− Σ2 Σ Σ
5) π (n− 5)
 sin − sin
and ωc = π
rad/sample ωc = 3π
rad/sample 4
π (n− 5)
4
for n ƒ =
2 4 hd (n) = 4
 3π−π 5
4
π4
for n = 5 for

The given window is rectangular hence

h(n) = hd (n)w (n) = hd (n)

For n=0,1,2..10 estimate the FIR filter coefficients h(n).


Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 62 / 94
FIR Filter Design Band Pass FIR Filter Design

Design a BPF using Hanning window with M=7. Given that lower cutoff frequency
ωc1 = 2rad/sec and ωc2 = 3rad/sec. Solution:

e for
−−ω j ωτ
c2 ≤ ω ≤

Hd (e jω
)= e − j ω τ for ωc1 ≤ c1ω−ω
≤ ωc2
 0 for − ωc − ωc1ω ≤ ωc1

M −1
τ = = 3
2

The inverse transform of the Hd (eω ) is H d(e j )


1

∫ π
1 jω jωn   c 2 c1 0 c1 c2 
hd (n) = Hd (e )e
2π −π
∫ − ωdω ∫ ωc2
1 c1
jω(n −τ )
= [ ejω( n−τ )dω + d
2π −ω c2 e ω
ωc1
Σ Σ− ωc1 Σ Σωc1
1 e jω( n−τ ) 1 e jω( n−τ )
= +
2π j(n − τ ) −ω 2π j(n − τ ) ω
c2 c2

1 [sinωc2(n − τ ) − sinωc1(n − τ
=
]
π(n − τ )
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 63 / 94
FIR Filter Design Band Pass FIR Filter Design

τ= M−
21 = 7−1 = 3 2
ωc1 = 2 rad/sec ωc2 = 3 rad/sec
for n ƒ = 3

hd (n) = 1 [sin3(n − 3) −
sin2(n − 3)]
π(n − 3) n h(n) n h(n)
for n = τ 0 0 4 0
Σ Σ 1 0.0189 5 0.0189
1 sinωc2(n − τ ) sinωc1(n − 2 -0.01834 6 -0.01834
hd (n) = lim − lim
π n→ τ (n − n→ τ (n − τ ) 3 0.3183
τ) τ)
1 hd (n) = [ωc2 − ωc1] = 1
π π

The given window function is Hanning window

2πnω(n) = 0.5 − 0.5cos


M −1

0≤ n≤ M − 1
for 0 ≤ n ≤ 6
This is rectangular window Σ
ofsin3(n
length−M=11. In this −
τ ) Σ− sin2(n case
τ
Σ Σ
h(n) = 2πn
h(n) = hd (n)ω(n) = hd (n)) π(n − 3) 0.5 − 0.5cosM −
1

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 64 / 94
FIR Filter Design Band Pass FIR Filter Design

Σ− 1
M Σ6
H (z ) = h(n)z− n = −n

h(n)z n=0 n=0


−1 −2 −3 −4 −5
= h(0) + h(1)z + h(2)z + h(3)z + h(4)z + h(5)z + 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
. (MΣ− 1)/ 2 . M − Σ
ω
|H(e j)| = h M−1 + 2h 1 − n cosωn
n=1
2
Σ
2
For M = 7

Σ3
|H(e j ω)| = h (3) + 2h (3 − n)
cosωn n=1

jω Σ3
|H(e )| = h (3) + 2h (3 − n)
cosωn n=1

Σ5
= h(3) + 2h (5 − n)
cosωn
= h(3) + 2h(2)cosω
n=1 + 2h(1)cos2ω + 2h(0)cos3ω
= 0.3183 − 0.3668cosω + 0.0378cos2ω
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 65 / 94
FIR Filter Design Bandstop FIR
Filter Design

Design a bandstop filter to reject the frequencies from 2 to 3 rad/sec using rectangular window
with M=5. Find the frequency response.

Solution:
H (e j )
 − j ωτ
d

 e for − π ≤ ω ≤ −ω c2 1
 − j ωτ
jω for − ω c1 ≤ ω≤ ω
Hd(e ) =
 e− j ωτ for ω c2≤ c1ω≤ π

0 for ωc1 ≤ |ω| ≤ ωc2  
 0
c2 
c1  c1 c2  
e
∫ π
1 jω jωn
hd (n) = H (e )e
2π − π d
∫ − ωdω ∫ ωc1 ∫ π
1 c2
= [ ejω( n−τ )dω + jω( n−τ )
dω + jω( n−τ )
d
2π − π e −ω c1 e ω
ωc2
Σ Σ− ωc2 Σ Σωc1 Σ Σπ
1 e jω( n−τ ) 1 ejω( n−τ ) 1e
= + jω( n−τ ) +
2π j(n − τ ) − π 2π j(n − τ ) −ω 2π j(n − τ ) ω
c1 c2

1 [sinωc1(n − τ ) + sinπ(n − τ − sinωc2(n − τ


=
]
π(n − τ )

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 66 / 94
FIR Filter Design Bandstop FIR Filter Design

The inverse transform of the Hd (eω ) is


M−1
τ= 2 = 5−1
= 2 ωc1 = 2 rad/sec ωc2 = 3 rad/sec
2

hd (n) = 1 [sin2(n − 2) + sinπ(n − 2) − sin3(n − for n ƒ =


2)] 2
π(n − 2)
for n = τ
Σ Σ
1 sinωc1(n − τ sinπ(n − sin c2 (n −
hd (n) = lim + lim − lim
π n→ τ (n − ) n→ τ τ )(n − n→ τ ω (n − τ)
τ) τ) τ)
1

hd (n) = 1 [ωc1 + π − ωc2] = [π − 1]


π π

The given window function is Rectangular window

ω(n) = 1
This is rectangular window of length M=5.
In this case h(n) = hd (n)ω(n) = hd (n) for 0 ≤ n ≤ 4
0≤ n≤ M − 1
hd (n) = 1 [sin2(n − 2) + sinπ(n − 2) − for n ƒ =
sin3(n − 2)] 2
π(n − 2)

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 67 / 94
FIR Filter Design Bandstop FIR Filter Design

Σ Σ
sin2(0 − 2) + sinπ(0 − 2) − sin3(0 −
n = 0 h(0) = 2) = −0.0759
π(0 − 2)
Σ Σ
sin2(1 − 2) + sinπ(1 − 2) − sin3(1 −
n = 1 h(1) = = 0.2445
2) π(1 − 2)
n = 2 h(2) = 1 [π − 1] =
0.6817
Σπ Σ
sin2(3 − 2) + sinπ(3 − 2) − sin3(3 −
n = 3 h(3) = = 0.2445
2) π(3 − 2)
Σ
sin2(4 − 2) + sinπ(4 − 2) − sin3(4 −
n = 4 h(4) = 2) = −0.0759
π(4 − 2)
Σ

Σ− 1
M Σ4
H (z ) = h(n)z− n = −n

h(n)z n=0 n=0

= h(0) + h(1)z − 1 + h(2)z −2


+ h(3)z −3
+ h(4)z −4

= −0.0759 + 0.2445z −1
+ 0.6817z −2
+ 0.2445z −3
− 0.0759z
−4

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 68 / 94
FIR Filter Design Bandstop FIR Filter Design

The magnitude response of a symmetric FIR filter with M=odd is


Σ
. (MΣ
− 1)/2 . M −1
ω
|H(e j)| = h M−1 + 2h − n cosωn
n=1
2
Σ
2
For M = 5

Σ2
|H(e j ω)| = h (2) + 2h (2 − n)
cosωn n=1

jω Σ3
|H(e )| = h (3) + 2h (3 − n)
cosωn n=1
h(2) + 2h(1)cosω + 2h(0)cos2ω
=
0.6817 + 2(0.2445)cosω +
= 2h(−0.0759)cos2ω
= 0.6817 + 0.4890cosω − 0.1518cos2ω

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 69 / 94
FIR Filter Design FIR Filter Design Using Kaiser Window

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
Σ . Σ
. Σ2
I0 α 1 − M − 1 2n

wk (n) =
I0(α)
where M is the order of the filter, I0 (x ) is a zeroth Bessel function of the first kind

Σ∞ Σ 1 . Σ k
I0(x ) = 1 + Σ
x 2
k!
k=1

1 + 0.25x + (0.25x ) + (0.25x


2 2 2
= +
2 )3 2
(1!) (3!) 2
(2!)2
α = 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
Dr. Manjunatha. P (JNNCE)
dB UNIT - 7: FIR Filter Design October 25, 2016 70 / 94
FIR Filter Design FIR Filter Design Using Kaiser Window

H () 1 Passband ripple


1  1 2 Stopband ripple
1 AP
˜ Ideal
1  1
LPF
AS
˜
Gain

2
P C S 
Passband Transition
Stopband
band
Figure 30: Frequency response of LPF

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 71 / 94
FIR Filter Design FIR Filter Design Using Kaiser Window
Kaiser Window Design Equations
1 Determine ideal frequency response
.
1 for |ω| ≤ c
Hd(e )j ω=
ω
0 for ωc ≤ |ω| ≤ π

where ωc = 1 (ω2 p + ωs )
2 Chose δ such that the actual passband ripple, Ap is equal to or less than the specified passband ripple A˜p ,
and the actual minimum stopband attenuation A is equal or greater than the specified minimum stop
attenuation A˜s

δ = min(δp, δs )
˜
100.05Ap
where δp= − 10.05A ˜
and δs= 10−0.05A
˜ s
10 p +1
3 The actual stopband attenuation is

A = −20log10δ

4 The parameter α is

 for A ≤ 21

α = for 21 < A ≤ 50
0.5842(A − 21)0.4 + 0.07886(Aa − 21)

0 for A > 50
0.1102(A −
8.7)
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 72 / 94
FIR Filter Design FIR Filter Design Using Kaiser Window

5 The value of M is found by


A−
M≥
7.95
∆ω ωs −ω p 14.36∆f
where ∆ f = 2π = and ∆ω is 2π
the width of transition band
6 Obtain impulse response by multiplying Kaiser window function

h(n) = hd (n)wk (n)

7 Obtain the causal finite impulse response


8 The system function is given by

Σ− 1
M
−n
H(z ) =
h(n)z n=0

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 73 / 94
FIR Filter Design FIR Filter Design Using Kaiser Window

π 4
Design a lowpass filter with a cutoff frequencies from wc = ∆ω = 0.02π and a stopband
ripple δs = 0.01. Use Kaiser window
Solution: .
1 for |ω| ≤
H d(e )j ω= c
ω
0 for ωc ≤ |ω| ≤ π A = −20logδs= −20log (0.01) = 40 dB
The inverse transform of the Hd (e j ω ) is

0.4
∫ π α = 0.5842(A − 21) + 0.07886(A −
1
hd (n) = H (e j ω )ejωn dω 21)
2π − π d 0.5842(40 − 21)0.4 + 0.07886(40 −
∫ ωc = 21)
1
= ej ωn = 3.4

−ω c dω
Σ ω
1 eΣ j ωn c 0.02π
= ∆f = = 0.01
2π jn 2π
−ω c
1 Σ jω cn Σ
= e − − j ω cn A−
2j πn e M ≥ 7.95 ≥ 223.189 c 225
Σ Σ 14.36∆f
1 ejω cn − − j ω cn
= 225 − 1
e
πn 2j τ= = 112
2
= sinωc n
πn

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 74 / 94
FIR Filter Design FIR Filter Design Using Kaiser Window

Σ . Σ
. Σ2
I0 α 1 − 2n
M−1
wk (n) = 0≤ n≤ M −
I0(α) 1
Σ , Σ
. 2n 2
I03.4 1 − Σ224
wk (n) = 0≤ n≤ M −
I0(3.4) 1
Σ , Σ
. 2n 2
I03.4 1 − Σ224
1
h(n) = hd × wk (n) = [sinωc n] × I0(3.4)
πn
where

t ∆ω 0.02π
ωc = ω +
c 2 = 0.25π + = 0.26π
2

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 75 / 94
FIR Filter Design FIR Filter Design
Using Kaiser Window

Find an expression for the impulse response h(n) of a linear phase lowpass FIR filter using Kaiser
window to satisfy the following magnitude response specifications for the equivalent analog filter.
Stopband attenuation: 40 dB
Passband ripple: 0.01 dB
Transition width: 1000 π rad/sec
Ideal cutoff frequency: 2400 π rad/sec
Sampling frequency: 10 KHz

Solution:

x(t) x(n) y(n) y(t)


A/D Filter D/A

A= −20logδs = 40 dB ∆Ω
∆ω = 1000π =
s = 0.1π rad f
logδs = −2 ⇒ δs = 0.01 10 ×
103
∆f = 0.1
20log (1 + δp ) = 0.01 =π 0.05

58.8 − 7.95
δp = 0.00115 M ≥ A − 7.95 ≥ = 70.82 c 71
log (1 + δp ) = 0.0005 14.36∆f 14.36 ×
δmin(δ p,sδ ) = 0.00115 0.05
A = −20log (0.00115) = 58.8 71 − 1
τ =
Dr. dB
Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 76 / 94
FIR Filter Design FIR Filter Design Using Kaiser Window

The attenuation is 58.8 dB then the parameter α is .


jω 1 for |ω| ≤ c
Hd (e ) = ω
α = 0.1102(A − 8.7) 0 for ωc ≤ |ω| ≤ π

= 0.1102(58.8 − 8.7) c 5.5 The inverse transform of the


Hd (e j ω ) is
Σ ,
. 2nΣ 2
Σ 1−
I05.5 ∫π
70 1 jω jωn
wk (n) = hd (n) = H (e )e
I0(5.5) 2π − π d
∫ ωc dω
1
= ej ωn
1 2π
−ω c dω
= Σ ω
ωc Ωc × T = 2400π × 1 eΣ j ωn c
10 × 103 =
= 0.24π 2π jn
−ω c
1 Σ jω c n Σ
= e − − j ωc n
2j πn e
t ∆ω Σ Σ
ω c = ωc + 1 ejω c n − − j ω n
2 = c
0.1 e
πn 2j
= 0.24π + π =
0.29π 2 = sinωc n

Σ πn
, Σ
. 2n 2
I05.48 1 − Σ224
1
h(n) = hd × wk (n) = [sinωc (n − τ )] I0(5.5)
π(n − τ )
×
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 77 / 94
FIR Filter Design FIR Filter Design Using Kaiser Window

Find an expression for the impulse response h(n) of a linear phase Design a lowpass FIR filter
satisfying the following specifications using Kaiser window

αp ≤ 0.1 dB αs ≥ 44 dB
ωp = 20 rad/sec ωs= 30 rad/sec ωsf = 100 rad/sec
Solution: .
1 for |ω| ≤ c
H d(e )j ω=
ω
0 for ωc ≤ |ω| ≤ π
∆ω = ωs − ωp = 10rad/sec 1
The inverse transform of the Hd (e j ω ) is
∫ π ωc = (ω
2 p+ ωs ) = 25rad/sec
1 jω jωn
hd (n) = H (e )e 25
2π − π d c
∫ ω c dω 100
π
1
= ω (in discrete
− 0.05As and radian) = 2 (2π) = rad
jωn
2π − ωc e dω = 10 = 6.3096 × − 3
δs = 10 − 0.05× 44
Σ j ωn ωc 10
1 eΣ 0.05×0.1 − 1
= 100.05Ap − 1 = 10 = 5.7563×10−3
2π jn δp =
−ω c 100.05Ap + 1 100.05×0.1 + 1
1 Σ jω cn Σ
= e − − j ω cn δ = min(δp, δs ) = 5.7563 × 10−3
2j πn e

= sinωc n A = −20log10(δ) = 44.797dB


πn

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 78 / 94
FIR Filter Design FIR Filter Design Using Kaiser Window

α = 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 = = =
10 100
0.1 ωsf
A− 44.797 −
M≥ ≥ ≥ 25.66 c 27
7.95 7.95
14.36∆f 27 − 1
14.36 × 0.1
τ = =
2
13
Σ . Σ
. Σ2
I0 α 1 − M2n −1
wk (n) = 0≤ n≤ M −
I0(α) 1
Σ , Σ
. 2nΣ 2
I03.9524 1 − 27
wk (n) = 0≤ n≤ M −
I0(3.9524) 1
Σ , Σ
. 2nΣ 2
I03.9524 1 − 27
1
h(n) = hd × wk (n) = [sinωc n] × I0(3.9524)
πn

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 79 / 94
FIR Filter Design FIR Filter Design Using Kaiser Window
Design a high pass digital satisfying the following specifications using Kaiser window

Passband cut-off frequency fp = 3200Hz Stopband cut-off frequency fs = 1600Hz Passband ripple

αp ≤ 0.1dB Stopband ripple αs ≥ 40dB


Sampling frequency.F = 10000Hz
Solution:Hd(e )j ω= 0 for |ω| ≤ c
ω
1 for ωc ≤ |ω| ≤ π
∆ ω = ωp − ωs = 3200π rad/sec
d j ω ) is
The inverse transform of the H (e
Σ 1
ωc = (ω
2 p+ ωs ) = 4800π rad/sec
1 Σ∫ − ωc j ωn ∫ π j ωn
hd (n) = e dω + e
2π − π dω 4800
Σ. (2π) = 0.48πrad
Σπ Σ
ωc
Σ
j ωn − ωc . ωc (discrete, radian) = 20000
1 ej ωn
= +
e
2π jn jn
−π ωc δs = 10−0.05As = 10−0.05×40 = 0.01
1 Σ − j ωc n −jπn
Σ
= ej π n −e + e − jω cn
2j πn e
100.05Ap − 1 100.05×0.1−1
= sinπn − sinωc n
δp = = =
πn 0.005756 100.05Ap + 1
100.05×0.1+1
ωp = 2πfp = 6400π rad/sec δ = min(δp, δs ) = 5.756 × 10−3

A = −20log10(δ) = 44.797dB
ωs = 2πfs = 3200π rad/sec

ωsf = P 2πF
Dr. Manjunatha. = 20000π
(JNNCE) rad/sec
UNIT - 7: FIR Filter Design October 25, 2016 80 / 94
FIR Filter Design FIR Filter Design Using Kaiser Window

α = 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 = = = 0.16
3200π
ωsf 20000π
A− 44.797 −
M≥ ≥ ≥ 16.03 c 17
7.95 7.95
14.36∆f 14.36 ×
17 − 1 0.16
τ = = 8
2
Σ . Σ
. Σ2
I0 α 1 − M2n −1
wk (n) = 0≤ n≤ M −
I0(α) 1
Σ , Σ
. 2nΣ 2
I03.9524 1 − 17
wk (n) = 0≤ n≤ M −
I0(3.9524) 1
Σ , Σ
. Σ 2
I03.9524 1 − 2n
h(n) = hd × wk (n) = sinπn − sinωc n × 27
I0(3.9524)
πn
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 81 / 94
Design of FIR system Frequency Sampling for FIR Filters

Design of FIR filter using Frequency Sampling


With necessary mathematical analysis explain the frequency sampling
technique of FIR filter design

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 82 / 94
Design of FIR system Frequency Sampling for FIR Filters
In this method a set of M equally spaced
samples in the interval (0, 2π)are taken in
the desired frequency response Hd (ω).
The continuous frequency ω is replaced by


ω = ωk = k k = 0, 1, . . . M
M
−1 | H d ( ) |  k
2 k 2  k
M 17
K=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

The discrete time Fourier transform (DTFT)


is 
4 8  3 30
 20 2
2
17 17 2 17 17
H(k) = Hd (ω)|.ω=ωk Σ
2π  ( ) 
= H
d k k = 0, 1, . . . M
M −1  k 
16 (k 17)
 8    16 k 17
k k
17

The inverse M point DFT (IDFT) h(n) is Magnitude frequency response is


symmetric about π, while ideal phase
M−1 response is antisymmetric about π
1 Σ
h(n) = H(k )ej ωn
M n=0
Σ− 1
M 2π kn
= 1 H(k)e j M n = 0, 1, . . . M
M n=0 −1

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 83 / 94
Design of FIR system Frequency Sampling for FIR Filters

For the FIR filter to be realizable the coefficients h(n) must be real. This is possible if all
complex terms appear in complex conjugate pairs. Consider the term
H ( M − k ) e j2πn(M−k) /M

j2πn( M−k)/M
j2πn −j2πkn/M
H(M − k)e = H(M − k)e e

j 2π n(M − k)/ M
− j 2π kn/ M ∵ e j2πn = cos(2πn) + jsin(2πn) = 1
H(M − k)e = H(M − k)e

substituting the |H(M − k)| = |H(k)|


j2 πn(M −k) /M
−j2πkn/M
H(M − k)e
= H(k)e

The term H(k)e − j 2 π k n / M is complex conjugate of H(k)e j 2 π k n / M . Hence


H(M − k)e j 2 π n ( M − k ) / M is complex conjugate of H(k)e − j 2 π k n / M

H(M − k ) = H ∗ (k)

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 84 / 94
Design of FIR system Frequency Sampling for FIR Filters

If H(M − k ) = H ∗ (k) then h(n)


, ,
1 ΣP Σ Σ
h(n) = H(0) + Re H (k )e j2πkn/M
2 M k=1

where P is . M−1
2 if M is odd
P= M
2− 1
if M is even

This equation is used to compute the coefficients of FIR filter.


H(z) is
Σ− 1
M
−n
H(z ) =
h(n)z n=0

Σ− 1
M
− j ωn
H (ω) =
h(n)e n=0

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 85 / 94
Design of FIR system Frequency Sampling for FIR Filters

Design a lowpass FIR filter using frequency sampling technique having cut-off frequency of π/2
rad/sample. The filter should have linear phase and length of 17.
Solution:
The Ideal LPF frequency response Hd (ω)
for the linear phase is
, ,
M− 1
,
2 k 2 k
π | H d () | k 
−jω 2 0≤ ω ≤ M  17
Hd (ω) = e π 2 K=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

2
≤ ω≤
0 π
. 
e− j 8ω 0 ≤ ω π2 4 8   20
3 30
2
Hd (ω) = 0 ≤ π2 ≤ ω ≤ π 2 17
17 17 2 17

To sample put ω = 2πk


M=
2πk  () 
17
16 (k 17)
16 k  k 
, 17
j 2π k k  8k  
e− 17 0 ≤ 2π
17
k
≤ π
2
17
Hd (ω) = 8
π
0 2
≤ 2π k

17 π The range of k is
17 = π
2πk k = 4 c
, 2 k = π k4 = 17 c

16πk 17
e− j 17 0≤ k≤ 4
17 17 2
Hd(ω) = 17 8
0 4
≤ k ≤ 17
2

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 86 / 94
Design of FIR system Frequency Sampling for FIR Filters

The value of h(n)is given by


 M− 1

1  Σ2 Σ Σ
h(n) = H(0) + 2 Re H ( k) e j2πkn/M 
M k=1
,
The range of k is 0 ≤ k ≤ 17
4 1 Σ8 Σ Σ
,
k is an integer. = 1+ 2 Re H(k)e j2πkn/17
Hence the range is 0 ≤ k ≤ 4 17 k=1
Similarly 174
17
≤k≤ = 4.25 ≤ k ≤
The range 25 ≤ k ≤ 8 8.5 |H(k)| = 1 0 ≤ k ≤ 4
 10≤ k ≤ 4
 ,
|H(k)| = 5≤ k ≤ 8 Σ4 ,
1 Σ
0  1 13 ≤ k ≤ 16 h(n) = 1+ 2 ReΣ e− j 16π17k
j 2π kn/ 17
e
17 k=1
,
Σ4 Σ ,
1 Σ
= 1+ 2 Re e j2πk(n−8)/17
17 k=1
, ,
1 Σ4 Σ Σ
= 1+ 2 2πk(n − 8)
17 cos k=1 17

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 87 / 94
Design of FIR system Frequency Sampling for FIR Filters

Determine the impulse response h(n) of a filter having desired frequency response
, , (M − 1)ω ,
−j π
Hd(w ) = e 2
0 ≤ |ω| ≤ 2
π
0 2
≤ ω≤
π
M = 7 use frequency sampling approach.
Solution:
The Ideal LPF frequency response
Hd (ω) is
, , , | H d () | k 
2 k 2 k
− j ω M −2 1 π M  7
Hd(ω) = e 0≤ ω ≤ 2 K=0 1 2 3 4 5 6 7
π
0 2
≤ ω≤
π 
. 2
e− j 3ω 0 ≤ ω π2 7
 4 6  8 10 3 12 2
Hd (ω) = 0 ≤π2 ≤ ω ≤ π 2 7 7 7 7 2 7
 ( )

To sample put ω = 2πk
M = 2πk

7 6 (k  7)
, 6 k  k  7
2π k k  3k  
e− j 7 0≤
2π k

π 7
Hd(ω) = 3
π
7 2
0 2
≤ 2π k

7 π The range of k is
, 6πk
e−j 7 0 ≤ k ≤ 74 7 = π2
2πk k = c
Hd(ω) = 7 4 k = π k1 = 7 c

0 7
4
≤ k ≤ 72 7 2
3
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 88 / 94
Design of FIR system Frequency Sampling for FIR Filters
The value of h(n)is given by
 
The range of k is 0 ≤ k ≤ 74 M− 1
Σ
1  Σ2 Σ
k is an integer. h(n) = H(0) + 2 
Hence the range is 0 ≤ k ≤ 1 M Re H ( k) e j2πkn/M
k=1
Similarly 747 ≤ k ≤ = 1.75 ≤ k ≤ ,
The range22 ≤ k ≤ 3
3.5 1 Σ3 Σ ,
j 2π kn/ 7 Σ
 10≤ k ≤ 1 = 1+ 2 Re H(k)e
 7 k=1
|H (k)| = 2≤ k≤ 3
0  1 k= 6
|H(k)| = 1 0≤ k ≤ 1
,
1 Σ1 Σ ,
n h(n) n h(n) 6π k Σ
h(n) = 1+ 2 Re e −j 7 e j2πkn/7
0 -0.1146 4 321 7
k=1
1 0.0793 5 0.0793 , ,
1 Σ1 Σ Σ
2 0.321 6 -0.1146 = 1+ 2
3 0.4283 7 Re e j2πk(n−3)/7
k=1
, Σ Σ,
1 Σ1 2πk(n −
= 1+ 2
7 cos k=1 3) 7
Determine the filter coefficients h(n) obtained by frequency sampling Hd (w ) given by
, − j 3ω
e 0 ≤ |ω| ≤ 2π
Hd (w ) = 0 π
≤ ω≤ π
2

Also obtain the frequency response H(w ). Take N=7. DEC 2011
Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 89 / 94
Design of FIR system Frequency Sampling for FIR Filters

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.
. Σ .
2π 1 k = 0, 1, 2,
H k =
3
15 0 k = 4, 5, 6,
7
Solution:
 10≤ k ≤ 3
2 k 2 k
 | H d () | k  M  15
|H (k )| = 4 ≤ k ≤ 11 K=0 12 3 4 5 6 7 8 9 10 11 12 13 14 15

0  1 12 ≤ k ≤ 14

3 28
4 6   18 2
2 15
15
. 15 15 2
− 14
πk 0≤ k≤ 7
θ(k) = 15  ()
14
14π − 14
15 πk = − 15 π(k − 15) 8 ≤ k ≤ 14 

14 (k 15)
14 k  k 
 7    15
k k
15

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 90 / 94
Design of FIR system Frequency Sampling for FIR Filters

The value of h(n)is given by


 M− 1

1  Σ2 Σ Σ
h(n) = H(0) + 2 Re H ( k) e j2πkn/M 
M k=1
, , n h(n) n h(n)
1 Σ7 Σ Σ
= 1+ 2 0 -0.05 8 0.3188
15 Re H(k)e j2πkn/7 1 0.041 9 0.034
k=1
2 0.066 10 -0.108
3 -0.036 11 -0.036
|H(k)| = 1 0 ≤ k ≤ 3 4 -0.108 12 0.066
, 5 0.034 13 0.041
Σ3 Σ , 6 0.3188 14 -0.05
1 17π k Σ
h(n) = 1+ 2 Re e −j 15 e j2πkn/15 7 0.466
715 k=1
,
Σ3 Σ ,
1 Σ
= 1+ 2 Re e j2πk(n−7)/15
15 k=1
, ,
1 Σ3 Σ Σ
= 1+ 2 2πk(n − 7)
15 cos k=1
15

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 91 / 94
Design of FIR system Frequency Sampling for FIR Filters

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.

. Σ 1 k

H  = 0, 1, 2, 3
k= 0.4
0
k= 4
15 k = 5, 6, 7
Solution:

1 0≤ k
 ≤3 | H d() | k 
2 k 2 k
0.4 k = 4 M  15
|H(k)| =  0 5 ≤ k ≤ 10 K=0 12 3 4 5 6 7 8 9 10 11 12 13 14 15


 0.4 k = 11 0.4 0.4

1 12 ≤ k ≤ 14 
4 6  3 28
 18 2
2 15
15 15 2 15

.  ()
− 14
πk 0≤ k ≤ 7 
θ(k) = 15
− 14
π(k − 15) 8 ≤ k ≤ 14
15 14 (k 15)
14 k  k  15
k  7k  
15

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 92 / 94
Design of FIR system Frequency Sampling for FIR Filters

The value of h(n)is given by


 M− 1

1  H(0) + 2 Σ2 Σ
Σ
h(n) = Re H ( k) e j2πkn/M 
k=1
,
Σ7 Σ , n h(n) n h(n)
1 Σ
= 1+ 2 Re H(k)e j2πkn/7 0 -0.0143 8 0.313
15 k=1 1 -0.002 9 -0.0181
2 0.04 10 -0.091
|H(k)| = 1 0 ≤ k ≤ 3 3 0.0122 11 0.0122
|H(k)| = 0.4 k = 4&11 4 -0.091 12 0.04
5 -0.0181 13 -0.002
, 6 0.313 14 -0.0143
Σ3 ,
1 Σ
Re Σe− j 17π k
h(n) = 1+ 2 15 7 0.520
715 j 2π kn/ 15
k=1 e
, ,
1 Σ3 Σ Σ Σ Σ
= 1+ 2 Re e j2πk(n−7)/15 + 2Re 0.4e j2π4(n−7)/15
15 k=1
, Σ Σ Σ ,
Σ3
=
1
1+ 2 Σ 2πk(n − 7) + 8π(n −
15 cos k=1 7) 15 15
0.8cos

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 93 / 94
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.

Dr. Manjunatha. P (JNNCE) UNIT - 7: FIR Filter Design October 25, 2016 94 / 94

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy