Chapter 6 Part 1 - Handout

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

06-04-2022

Digital Signal Processing ( EACT 537)

Chapter 6:
FILTER DESIGN TECHNIQUES
- Design of FIR Filters
- Design of IIR Filters

By

Dr. Petchinathan Govindan


Assistant professor

Digital Filters
• Filters: Frequency selective devices.
• It is an LTI system performs a type of discrimination or
filtering among the various frequency components at
its input.
• The nature of this filtering action is determined by the
frequency response characteristics H( 𝑒 𝑗𝜔 ) which in
turn depends on the choice of the system parameters.
N M
y (n) −  ak y (n − k ) =  bk x(n − k )
𝑀

𝑦(𝑛) = ෍ 𝑏𝑘 𝑥(𝑛 − 𝑘)
k =1 k =0
𝑘=0

𝐻(𝑧)
σ𝑀𝑘= 𝑏𝑘 𝑧
−𝑘 𝑀
IIR Filter = 𝑁
1 − σ𝑘=1 𝑎𝑘 𝑧 −𝑘 𝐻(𝑧) = ෍ 𝑏𝑘 𝑧 −𝑘
FIR Filter 𝑘=0

1
06-04-2022

Digital Filter Specifications


Magnitude Response of Ideal Digital filter
Low Pass High Pass

Band Pass Band Stop


Notch Filter or Band Reject Filter

Digital Filter Specifications


Magnitude Response of a Practical Low Pass filter
p -Passband edge frequency

s - Stopband edge frequency

𝛿𝑝 - Peak ripple value in the passband

s - Peak ripple value in the stopband

2
06-04-2022

Digital Filter Specifications

• In the passband 0     p we require that


G (e j )  1 with a deviation   p
1 −  p  G (e j )  1 +  p ,    p
• In the stopband  s     we require that
G (e j )  0 with a deviation  s
G (e j )   s ,  s    
 p -passband edge frequency
s - stopband edge frequency
 p - peak ripple value in the passband
 s - peak ripple value in the stopband

Digital Filter Specifications

• In practice, passband edge frequency Fp and


stopband edge frequency Fs are specified in Hz
• For digital filter design, normalized band edge
frequencies ( in rad) need to be computed from
specifications in Hz using

 p 2 Fp
p = = = 2 FpT radians
FT FT
 s 2 Fs
s = = = 2 Fs T radians
FT FT

3
06-04-2022

Digital Filter Specifications

• Example - Let Fp = 7 kHz, Fs = 3 kHz, and


F = 25 kHz
T

Then
2 (7 103 )  p 2 Fp
p = = 0.56 p = = = 2 FpT
25 103 radians FT FT

2 (3 103 )  s 2 Fs
s = = 0.24 s = = = 2 Fs T
25 103 radians FT FT

Digital FIR Filters


• The specification of a digital filters→ Desired frequency
response Hd(𝑒 𝑗𝜔 ) .
• Desired impulse response hd(n)= Inverse Fourier Transform of
Hd(𝑒 𝑗𝜔 ).
• hd(n)→ infinite duration DT signal, defined for all values of n in
the range of -∞ 𝑡𝑜 + ∞.
• Transfer function of Digital Filter H(z)→ Z- Transform of
{hd(n)}
• H(z)→ have infinite terms, not possible to realize or implemented
in real-time.
• Let h(n)→Finite number of samples in hd(n), selected.
• Now, Transfer function of Digital Filter H(z) is obtained by Z-
Transform of {h(n)}.
• Filters designed by using finite samples of impulse response are
called FIR ( Finite Impulse Response) Filters

4
06-04-2022

Digital FIR Filters

◼ The transfer function is given by


N −1
H ( z ) =  h(n).z −n
n =0
◼ The length of Impulse Response is N
◼ All poles are at z = 0. ( No poles)
◼ Zeros can be placed anywhere on the z-plane
◼ Fourier transform of h(n) is
𝑁−1

𝐻 𝑒 𝑗𝜔 = ෍ ℎ(𝑛)𝑒 −𝑗𝜔𝑛
𝑛=0

Digital FIR Filters

◼ Note that FIR filters have only zeros (no


poles), Hence known also as all-zero
filters
◼ FIR filters also known as feedforward
or non-recursive, or transversal filters

5
06-04-2022

Linear Phase Filters

◼ Frequency response H(𝑒 𝑗𝜔 ) is complex quantity,


hence we can write,

 Magnitude

 Phase
𝛼 - Constant phase delay
◼ From the above Equation, the magnitude of freq.
response is constant. Therefore, the phase function
of frequency response of a filter is linear function of
phase, then the filter is called linear phase filter.

Ideal frequency response of linear Phase FIR Filter

Low Pass

High Pass

6
06-04-2022

Ideal frequency response of linear Phase FIR Filter

Band Pass

Band Stop
Notch Filter or Band Reject Filter

Design Techniques for Linear Phase FIR Filters

◼ Methods:
◼ Fourier Series method
◼ Window method

◼ Frequency Sampling method

◼ Optimal filter design method

Windows are finite duration sequence used to truncate


and modify the impulse response of FIR filter

7
06-04-2022

Design of FIR Filters using Windows


Step 1:
▪ The desired frequency response, Hd(𝑒 𝑗𝜔 )= C 𝑒 −𝑗𝛼𝜔
where C- Constant (usually, C=1=Normalised Magnitude)
𝑁−1
Constant phase delay or centre of symmetry 𝛼 = 2
▪ The cut-off frequency 𝜔𝑐 for lowpass and High-Pass, and 𝜔𝑐1 and
𝜔𝑐2 for bandpass and band-stop filter.
▪ If analog cut-off frequency Fc and sampling frequency Fs are
specified, then calculate the cut-off frequency of digital filter 𝜔𝑐
using the equation,
2𝜋𝐹𝑐
𝜔𝑐 = 𝐹𝑠
• The number of samples of impulse response, N

Design of FIR Filters using Windows


Step 2:
• Determine the desired impulse response, hd(n) by taking inverse
Fourier transform of the desired frequency response 𝐻𝑑(𝑒 𝑗𝜔 )
1 +𝜋
ℎ𝑑 𝑛 = 2𝜋 ‫׬‬−𝜋 𝐻𝑑 (𝑒 𝑗𝜔 ) 𝑒 𝑗𝜔𝑛 𝑑𝜔
Step 3:
• Choose the desired window sequence w(n) defined for n=0 to N-1.
Multiply hd(n) with w(n) to get the impulse response h(n) of the
filter. Calculate N-Samples of the impulse response for n=0 to N-1.
• Impulse response, h(n)= ℎ𝑑 𝑛 ∗ 𝑤(𝑛) ; for n=0 to N-1
• The impulse response is symmetric with centre of symmetry at
(N-1)/2 and so h(N-1-n)=h(n).
• Hence it is sufficient if we calculate h(n) for n=0 to (N-1)/2

8
06-04-2022

Design of FIR Filters using Windows

Step 4:
Take Z- Transform of the impulse response h(n) to get the
transfer function H(z) of the filter.

Transfer function
𝑁−1

𝐻 𝑧 =𝑍 ℎ 𝑛 = ෍ ℎ(𝑛)𝑧 −𝑛
𝑛=0

Step 5: Draw a suitable structure of realization of FIR filter.

Ideal (Desired ) frequency response and Impulse


response for FIR filter design
Low Pass High Pass

Ideal (Desired ) frequency Ideal (Desired ) frequency

Impulse Response Impulse Response

9
06-04-2022

Ideal (Desired ) frequency response and Impulse


response for FIR filter design
Band Pass Band Stop Notch Filter or Band Reject Filter

Ideal (Desired ) frequency


Ideal (Desired ) frequency

Impulse Response Impulse Response

Windows Sequence for FIR Filter Design

Rectangular

Windows are finite duration


sequence used to truncate and
modify the impulse response of
FIR filter.

Bartlett
OR
Triangular

10
06-04-2022

Windows Sequence for FIR Filter Design

Hanning

Hamming

Windows Sequence for FIR Filter Design

Blackman

11
06-04-2022

Design of FIR Filters using Windows- Example 1

Example 1:
Design a Linear phase FIR Low Pass filter using rectangular window by taking
7 samples of window Sequence and with a cut-off frequency, 𝝎𝒄 = 𝟎. 𝟐𝛑
rad/sample.
Solution :
Choose Symmetric impulse response with symmetry condition h(N-1-n)=h(n)
Desired ideal frequency response Hd(𝑒 𝑗𝜔 ) of FIR low Pass filter is

Step 2:
• Determine the desired impulse response, hd(n) by taking inverse Fourier
transform of the desired frequency response 𝐻𝑑 (𝑒 𝑗𝜔 )
1 +𝜋 1 +𝜔𝑐
ℎ𝑑 𝑛 = ‫) 𝜔𝑗 𝑒( 𝐻 ׬‬
2𝜋 −𝜋 𝑑
𝑒 𝑗𝜔𝑛 𝑑𝜔 = ‫׬‬ 𝐻 (𝑒 𝑗𝜔 )
2𝜋 −𝜔𝑐 𝑑
𝑒 𝑗𝜔𝑛 𝑑𝜔

Design of FIR Filters using Windows- Example 1


Step 2:
1 +𝜋 1 +𝜔
ℎ𝑑 𝑛 = 2𝜋 ‫׬‬−𝜋 𝐻𝑑 (𝑒 𝑗𝜔 ) 𝑒 𝑗𝜔𝑛 𝑑𝜔 = 2𝜋 ‫׬‬−𝜔 𝑐 𝑒 −𝑗𝜔𝛼 𝑒 𝑗𝜔𝑛 𝑑𝜔
𝑐

+𝜔𝑐
1 +𝜔𝑐 𝑗𝜔(𝑛−𝛼) 1 𝑒 𝑗𝜔(𝑛−𝛼) 1 𝑒 𝑗𝜔𝑐 (𝑛−𝛼)
= න 𝑒 𝑑𝜔 = = ቈ
2𝜋 −𝜔𝑐 2𝜋 𝑗(𝑛 − 𝛼) −𝜔𝑐
2𝜋 𝑗(𝑛 − 𝛼)
−𝑗𝜔𝑐 (𝑛−𝛼)
𝑒 WKT
− ቉
𝑗(𝑛 − 𝛼)

1 𝑒 𝑗𝜔𝑐 (𝑛−𝛼) − 𝑒 −𝑗𝜔𝑐 (𝑛−𝛼)


ℎ𝑑 𝑛 =
𝜋(𝑛 − 𝛼) 2𝑗
sin 𝜔𝑐 (𝑛 − 𝛼)
ℎ𝑑 𝑛 = 𝑓𝑜𝑟 𝑎𝑙𝑙 𝑛 , 𝑒𝑥𝑐𝑒𝑝𝑡 𝑛 = 𝛼
𝜋(𝑛 − 𝛼)

12
06-04-2022

Design of FIR Filters using Windows- Example 1


Step 2: ( Cont..)

When 𝑛 = 𝛼, ℎ𝑑 𝑛 becomes 0/0→ indeterminate form.


Using L’Hospital rule,
𝑺𝒊𝒏 𝑨𝜽
lim =𝑨
𝜽→𝟎 𝜽
When 𝑛 = 𝛼
sin 𝜔𝑐 (𝑛−𝛼) 𝟏 sin 𝜔𝑐 (𝑛−𝛼) 𝟏 𝜔𝑐
ℎ𝑑 𝑛 = lim = lim = ∗ 𝜔𝑐 =
(𝑛−𝛼)→𝟎 𝜋(𝑛−𝛼) 𝝅 (𝑛−𝛼)→𝟎 (𝑛−𝛼) 𝝅 𝝅

Finally desired impulse response of FIR low pass filter


sin 𝜔𝑐 (𝑛 − 𝛼)
ℎ𝑑 𝑛 = 𝑓𝑜𝑟 𝑎𝑙𝑙 𝑛 , 𝑒𝑥𝑐𝑒𝑝𝑡 𝑛 = 𝛼
𝜋(𝑛 − 𝛼)
𝜔𝑐
ℎ𝑑 𝑛 = 𝑓𝑜𝑟 𝑛 = 𝛼
𝝅

Design of FIR Filters using Windows- Example 1


Step 3:
Rectangular window sequence w(n) defined for n=0 to N-1( Given in the Problem)
Impulse response, h(n)= ℎ𝑑 𝑛 ∗ 𝑤𝑅 (𝑛) ; for n=0 to N-1
The impulse response is symmetric with centre of symmetry
at 𝛼=(N-1)/2 and so h(N-1-n)=h(n).
Hence it is sufficient if we calculate h(n) for n=0 to (N-1)/2
Rectangular window sequence

Impulse response, h(n)= ℎ𝑑 𝑛 ∗ 1= ℎ𝑑 𝑛 ; for n=0 to N-1

Here N=7 and 𝜔𝑐 = 0.2𝜋 rad/sample.


centre of symmetry 𝛼=(N-1)/2=(7-1)/2=3
We have to calculate h(n) for n=0 to 6

13
06-04-2022

Design of FIR Filters using Windows- Example 1


Step 3: Impulse response, h(n) for n= 0 to 6 Calculate Ɵ by keeping
calculator in radian
mode

Symmetry condition
h (N-1-n)=h(n)
That is , h(6-n)=h(n)

Design of FIR Filters using Windows- Example 1

Step 4:Take Z- Transform of the impulse response h(n) to


get the transfer function H(z) of the filter.

14
06-04-2022

Design of FIR Filters using Windows- Example 1

Step 5: Linear Phase Structure Realization of Low Pass FIR Filter

Design of FIR Filters using Windows- Example 2

Example 2:
Design a Linear phase FIR High Pass filter using hamming window by taking 7 samples
of window Sequence and with a cut-off frequency, 𝝎𝒄 = 𝟎. 𝟖𝛑 rad/sample.
Solution :
Choose Symmetric impulse response with symmetry condition h(N-1-n)=h(n)
Desired ideal frequency response Hd(𝑒 𝑗𝜔 ) of FIR High Pass filter is

Step 2:
• Determine the desired impulse response, hd(n) by taking inverse Fourier
transform of the desired frequency response 𝐻𝑑 (𝑒 𝑗𝜔 )

15
06-04-2022

Design of FIR Filters using Windows- Example 2


Step 2:

WKT

Design of FIR Filters using Windows- Example 2


Step 2:

16
06-04-2022

Design of FIR Filters using Windows- Example 2


Step 3:
Hamming window sequence wH(n) defined for n=0 to N-1( Given in the Problem)
Impulse response, h(n)= ℎ𝑑 𝑛 ∗ 𝑤𝐻 (𝑛) ; for n=0 to N-1
The impulse response is symmetric with centre of symmetry
at 𝛼=(N-1)/2 and so h(N-1-n)=h(n).
Hence it is sufficient if we calculate h(n) for n=0 to (N-1)/2
Hamming window sequence

Here N=7 and 𝜔𝑐 = 0.8𝜋 rad/sample.


centre of symmetry 𝛼=(N-1)/2=(7-1)/2=3
We have to calculate h(n) for n=0 to 6

Design of FIR Filters using Windows- Example 2


Step 3: Impulse response, h(n) for n= 0 to 6 Calculate Ɵ by keeping
calculator in radian
mode

Since n and 𝜶 are integers


sin(n- 𝜶) 𝝅 = 0

Symmetry condition
h (N-1-n)=h(n)
That is , h(6-n)=h(n)

17
06-04-2022

Design of FIR Filters using Windows- Example 2

Step 4:Take Z- Transform of the impulse response h(n) to


get the transfer function H(z) of the high pass filter.

Design of FIR Filters using Windows- Example 2


Step 5: Linear Phase Structure Realization of High Pass FIR Filter

18
06-04-2022

Design of FIR Filters using Windows- Example 3

Example 3:
Design a Linear phase FIR Band Pass filter using hanning window by taking 7 samples
of window Sequence and with a frequency range𝟎. 𝟒𝛑 𝒕𝒐 𝟎. 𝟔𝟓𝛑 rad/sample.
Solution :
Choose Symmetric impulse response with symmetry condition h(N-1-n)=h(n)
Desired ideal frequency response Hd(𝑒 𝑗𝜔 ) of FIR High Pass filter is

Step 2:
• Determine the desired impulse response, hd(n) by taking inverse Fourier
transform of the desired frequency response 𝐻𝑑 (𝑒 𝑗𝜔 )

Design of FIR Filters using Windows- Example 3


Step 2:

WKT

19
06-04-2022

Design of FIR Filters using Windows- Example 3


Step 2:

Design of FIR Filters using Windows- Example 3


Step 3:
Hamming window sequence wc(n) defined for n=0 to N-1( Given in the Problem)
Impulse response, h(n)= ℎ𝑑 𝑛 ∗ 𝑤𝐶 (𝑛) ; for n=0 to N-1
The impulse response is symmetric with centre of symmetry
at 𝛼=(N-1)/2 and so h(N-1-n)=h(n).
Hence it is sufficient if we calculate h(n) for n=0 to (N-1)/2
Hanning window sequence

centre of symmetry 𝛼=(N-1)/2=(7-1)/2=3, We have to calculate h(n) for n=0 to 6

20
06-04-2022

Design of FIR Filters using Windows- Example 3


Step 3: Impulse response, h(n) for n= 0 to 6

Calculate Ɵ by keeping
calculator in radian
mode

Symmetry condition
h (N-1-n)=h(n)
That is , h(6-n)=h(n)

Design of FIR Filters using Windows- Example 3

Step 4:Take Z- Transform of the impulse response h(n) to


get the transfer function H(z) of the Band pass filter.

21
06-04-2022

Design of FIR Filters using Windows- Example 3


Step 5: Linear Phase Structure Realization of Band Pass FIR Filter

Design of FIR Filters using Windows- Exercise

Excercise:
Design a Linear phase FIR Band stop filter using Rectangular window by taking 7
samples of window Sequence and with a frequency range 𝟎. 𝟒𝛑 𝒕𝒐 𝟎. 𝟔𝟓𝛑 rad/sample.
Answer:

22
06-04-2022

Design of FIR Filters using Windows- Exercise

Exercise Answer (cont…):

Design of FIR Filters – Some Important Points

• Linear phase FIR filters has a constant phase delay


within the desired frequency range.
• In FIR filter phase function is linear function of 𝝎
• The linear phase FIR filters with constant phase delay
will have symmetric impulse response with symmetry
condition h(N-1-n)=h(n) and with centre of symmetry
at 𝜶 = (𝑵 − 𝟏)/𝟐.
• Frequency response of a digital filter is periodic with
period equal to 2𝝅.
• Windows are finite duration sequence used to truncate
and modify the impulse response of FIR filter.

23
06-04-2022

End of Chapter 6 Part -1

24

You might also like