0% found this document useful (0 votes)
12 views

7 FIR filter

The document discusses the design of FIR filters using the windowing method, detailing the four basic types of linear phase FIR filters and their impulse responses. It outlines the steps for designing FIR filters, including determining specifications, selecting window functions, and computing impulse responses. Additionally, it provides examples of lowpass, highpass, and bandpass filter designs, along with the use of adjustable Kaiser windows.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

7 FIR filter

The document discusses the design of FIR filters using the windowing method, detailing the four basic types of linear phase FIR filters and their impulse responses. It outlines the steps for designing FIR filters, including determining specifications, selecting window functions, and computing impulse responses. Additionally, it provides examples of lowpass, highpass, and bandpass filter designs, along with the use of adjustable Kaiser windows.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

Module 7: Design of FIR filters by

windowing method

1
4 basic types of generalized linear phase
FIR filters

Filter Length Symmetric / Anti Impulse Response Type


Odd symmetric h(n) = h(M-n) 1
Even symmetric h(n) = h(M-n) 2
Odd anti-symmetric h(n) = -h(M-n) 3
Even anti-symmetric h(n) = -h(M-n) 4

2
4 basic types of generalized linear phase
FIR filters

3
4 basic types of generalized linear phase
FIR filters

4
4 basic types of linear phase FIR filters
h1= [0.5, 1, 1, 1, 1, 1, 0.5]; % FIR 1
h2= [0.5, 1, 1, 1, 1, 1, 1, 0.5]; % FIR 2
h3= [0.5, 1, 1, 0, -1, -1, -0.5] ; %FIR 3
h4= [0.5, 1, 1, -1, -1, -0.5]; % FIR 4

[H1 w]=freqz(h1, 1, 512);

figure
% Plot the magnitude and phase responses
% in angular frequency from 0 to pi
subplot(121); plot(w/pi, abs(H1));grid; ylabel('FIR 1')
subplot(122); plot(w/pi, unwrap(angle(H1)));grid;

figure
%Plot the zero - pole plots
figure
zplane(h1,1); grid
title('FIR 1')
5
Ideal filters

6
Ideal lowpass FIR filter

ℎ𝑑 𝑛

Inverse DTFT

1, 𝜔 ≤ 𝜔𝑐 sin(𝜔𝑐 𝑛)
𝐻𝑑 𝑒 𝑗𝜔 =ቊ ℎ𝑑 𝑛 =
0 𝜔𝑐 < 𝜔 ≤ 𝜋 𝜋𝑛

Noncausal and infinite number of coefficients → unrealizable


7
Design of FIR filters by windowing

• The basic idea behind the window design is to choose a proper


ideal frequency-selective filter (which always has a noncausal,
infinite-duration impulse response) and then to truncate and shift (or
window) its impulse response to obtain a linear-phase and causal
FIR filter

8
Design of FIR filters by windowing

ℎ𝑑 𝑛

Truncate and shift

Noncausal and infinite


number of coefficients

9
Design of FIR filters by windowing
The DTFT of the product of two sequences is
DTFT 1
𝑎 𝑛 = 𝑥 𝑛 𝑤[𝑛] 𝐴(𝑒 𝑗𝜔 ) = න 𝑋 𝑒 𝑗𝜃 𝑊 𝑒 𝑗 𝜔−𝜃
𝑑𝜃
2𝜋 2𝜋

10
Example

• Lowpass FIR filter with fc=100Hz

11
Actual frequency response and Filter
specifications
Absolute specifications

➢ 0 ≤ 𝜔 ≤ 𝜔𝑝
1 − 𝛿𝑝 ≤ 𝐻 𝑒 𝑗𝜔 ≤ 1 + 𝛿𝑝
➢ 𝜔𝑠 ≤ 𝜔 ≤ 𝜋
𝐻 𝑒 𝑗𝜔 ≤ 𝛿𝑠

Relative specifications

1 + 𝛿𝑝
𝐴𝑝 = 20 log10
1 − 𝛿𝑝

1 + 𝛿𝑝
𝐴𝑠 = 20 log10 ≈ −20 log10 𝛿𝑠
𝛿𝑠
12
Window functions

13
Window functions

14
Properties of commonly used windows

𝐿 =𝑀+1

15
Design of FIR filters by windowing

1. Given the design specifications 𝜔𝑝 , 𝜔𝑠 , 𝐴𝑝 , 𝐴𝑠 , determine the ripples 𝛿𝑝


and 𝛿𝑠 and set 𝛿 = min{𝛿𝑝 , 𝛿𝑠 }
2. Determine the cutoff frequency of the ideal lowpass prototype by
𝜔𝑐 = (𝜔𝑝 + 𝜔𝑠 )/2
3. Determine the design parameters 𝐴 = −20 log10 𝛿 and ∆𝜔 = 𝜔𝑠 − 𝜔𝑝
4. Choose the window function that provides the smallest stopband
attenuation greater than A. For this window, determine the required value
of 𝑀 = 𝐿 − 1. If 𝑀 is odd, we may increase it by one.
5. Determine the impulse response of the ideal lowpass filter by
sin[𝜔𝑐 (𝑛)]
ℎ𝑑 𝑛 =
𝜋(𝑛)

𝑀 𝑀
where 𝑛 = (− : )
2 2

16
Design of FIR filters by windowing
6. Compute the impulse response ℎ 𝑛 = ℎ𝑑 𝑛 𝑤[𝑛] using the chosen window
7. Check whether the designed filter satisfies the prescribed specifications; if
not, increase the order 𝑀 and go back to step 5.

17
Design of FIR filters by windowing

• Example: Design a lowpass linear-phase FIR filter to satisfy the


following specifications:

𝜔𝑝 = 0.25𝜋 𝜔𝑠 = 0.35𝜋 𝐴𝑝 = 0.1 𝑑𝐵 𝐴𝑠 = 50 𝑑𝐵

1 + 𝛿𝑝
𝐴𝑝 = 20 log10
1 − 𝛿𝑝

18
Design of FIR filters by windowing

• Example: Design a lowpass linear-phase FIR filter to satisfy the


following specifications:

𝐹𝑝 = 40𝐻𝑧 𝐹𝑠 = 50𝐻𝑧 𝐴𝑝 = 0.1 𝑑𝐵 𝐴𝑠 = 50 𝑑𝐵

Sampling frequency 𝑓𝑠 = 1000𝐻𝑧


• Use the filter to remove the 60Hz noise in the openloop signal

19
Design of FIR filters by windowing

• Example: Design a highpass linear-phase FIR filter to satisfy the


following specifications:

𝐹𝑝 = 300𝐻𝑧 𝐹𝑠 = 200𝐻𝑧 𝐴𝑝 = 0.2 𝑑𝐵 𝐴𝑠 = 40 𝑑𝐵

Sampling frequency 𝑓𝑠 = 1200𝐻𝑧

20
Design of FIR filters by windowing

• A highpass FIR filter can also be obtained by replacing z with -z in


the transfer function of a lowpass FIR filter
𝑀−1

𝐻ℎ𝑝 𝑧 = 𝐻𝑙𝑝 (−𝑧) = ෍ 𝑏𝑛 −1 𝑛 𝑧 −𝑛 𝐻ℎ𝑝 (𝑒 𝑗𝜔 ) = 𝐻𝑙𝑝 (𝑒 𝑗 𝜔−𝜋 )


𝑛=0

• Example:

Lowpass filter Highpass filter


1 1
(1 + 𝑧 −1 ) (1 − 𝑧 −1 )
2 2

21
Design of FIR filters by windowing

• A bandpass filter

DTFT
1
ℎ 𝑘 𝑐𝑜𝑠𝜔𝑚 𝑘 ↔ 2
[𝐻(𝑒 𝑗 𝜔−𝜔𝑚 + 𝐻(𝑒 𝑗 𝜔+𝜔𝑚 ]

22
Design of FIR filters by windowing

• Example: Design a band-pass filter with the cut-off frequencies


𝐹𝑐1 = 300𝐻𝑧 and 𝐹𝑐2 = 700𝐻𝑧. Both the low and high transition bands
of this filter are 100𝐻𝑧. The stop-band attenuation needs to be
greater than 60𝑑𝐵 and the pass-band ripple is expected to be less
than 0.1𝑑𝐵. Assume that the sampling frequency 2000𝐻𝑧

23
Filter design using the adjustable
Kaiser window
2
𝑛−𝛼
𝐼𝑂 𝛽 1 − 𝑥 𝑚
𝛼 ∞
𝑤𝑛 = 2
, 0≤𝑛≤𝑀 𝐼𝑂 𝑥 = 1 + ෍
𝐼𝑂 𝛽 𝑚!
𝑚=1
0, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒

0, 𝐴 < 21
𝛽 = ቐ0.5842 𝐴 − 21 0.4 + 0.07886 𝐴 − 21 , 21 ≤ 𝐴 ≤ 50
0.1102 𝐴 − 8.7 , 𝐴 > 50

𝐴−8
𝑀=
2.285∆𝜔
24
Filter design using the adjustable
Kaiser window
𝑀 = 20

𝛽=5

25
Filter design using the adjustable
Kaiser window
1. Given the design specifications 𝜔𝑝 , 𝜔𝑠 , 𝐴𝑝 , 𝐴𝑠 , determine the ripples 𝛿𝑝
and 𝛿𝑠 and set 𝛿 = min{𝛿𝑝 , 𝛿𝑠 }
2. Determine the cutoff frequency of the ideal lowpass prototype by
𝜔𝑐 = (𝜔𝑝 + 𝜔𝑠 )/2
3. Determine the design parameters 𝐴 = −20 log10 𝛿 and ∆𝜔 = 𝜔𝑠 − 𝜔𝑝
4. Determine the required values of 𝛽 and 𝑀. If 𝑀 is odd, we may increase it
by one.
5. Determine the impulse response of the ideal lowpass filter by

sin[𝜔𝑐 (𝑛)]
ℎ𝑑 𝑛 =
𝜋(𝑛)

𝑀 𝑀
where 𝑛 = (− : )
2 2

26
Filter design using the adjustable
Kaiser window
6. Compute the impulse response ℎ 𝑛 = ℎ𝑑 𝑛 𝑤[𝑛] using the Kaiser window
7. Check whether the designed filter satisfies the prescribed specifications; if
not, increase the order 𝑀 and go back to step 5.

27
Filter design using the adjustable
Kaiser window
• Consider the lowpass linear-phase FIR filter specifications

𝜔𝑝 = 0.25𝜋 𝜔𝑠 = 0.35𝜋 𝐴𝑝 = 0.1 𝑑𝐵 𝐴𝑠 = 50 𝑑𝐵


Design the filter using Kaiser window

28
Highpass, bandpass…

• https://www.allaboutcircuits.com/technical-articles/design-examples-
of-fir-filters-using-window-method/

29
Discrete-time frequency transformations

𝐻𝑙𝑝 (𝑤) 𝐻(𝑧)

𝑤 −1 = 𝐺(𝑧 −1 )

𝐻 𝑧 = 𝐻𝑙𝑝 𝑤 ቚ
𝑤 −1 =𝐺(𝑧 −1 )

• 𝐺(𝑧 −1 ) should be a rational function of 𝑧 −1 . This ensures that a


rational 𝐻𝑙𝑝 𝑤 will be transformed into a rational 𝐻(𝑧).
• The interior of the unit circle in the 𝑤-plane must map to the interior
of the unit circle in the z-plane. This requirement preserves stability.
• The unit circle of the 𝑤-plane must map onto the unit circle of the z-
plane.

30
Discrete-time frequency transformations

On the unit circle:


𝐺(𝑒 −𝑗𝜔 ) = 1 (allpass filter)
−𝑗𝜃 −𝑗𝜔 𝑗 𝐺(𝑒 −𝑗𝜔 )
𝑒 = 𝐺(𝑒 )𝑒
−𝜃 = 𝐺(𝑒 −𝑗𝜔 )
−1 + 𝛼
𝑧
Example of an allpass filter: 𝑤 −1 = 𝐺 𝑧 −1 = −
1 + 𝛼𝑧 −1
𝑒 −𝑗𝜔 + 𝛼
On the unit circle: 𝑒 −𝑗𝜃 = −
1 + 𝛼𝑒 −𝑗𝜔

We obtain: 𝑐𝑜𝑠 (𝜃𝑐 + 𝜔𝑐 )/2


𝛼=−
𝑐𝑜𝑠 (𝜃𝑐 − 𝜔𝑐 )/2
31
Discrete-time frequency transformations

32
Task 3

• Design a FIR low-pass filter for DC motor’s velocity

33
Matlab implementation

• fdatool

34

You might also like