Anda di halaman 1dari 25

SEL4223 Digital Signal Processing

FIR Filter Design

Musa Mohd Mokji


Introduction
• The design will be based on zeros instead of poles where all poles
will only exist at 𝑧 = 0
• Thus, the difference equation of an FIR filter does not consists of
past or future output sequence where an FIR filter of order 𝑀 with
input 𝑥[𝑛] and output 𝑦[𝑛] can be represented as follow

𝑦 𝑛 = 𝑏0 𝑥 𝑛 + 𝑏1 𝑥 𝑛 − 1 + ⋯ + 𝑏𝑀 𝑥[𝑛 − 𝑀]
𝑀

= ෍ 𝑏𝑘 𝑥[𝑛 − 𝑘]
𝑘=0

• Designing FIR filter is actually a process of finding the filter


coefficients 𝑏𝑘 .
Filter Coefficients
• Generally, filter coefficients are group into two vectors; a and b.
• These coefficients are the weights of below difference equation:
𝑁 𝑀

෍ 𝑎𝑘 𝑦 𝑛 − 𝑘 = ෍ 𝑏𝑘 𝑥[𝑛 − 𝑘]
𝑘=0 𝑘=0

• Where 𝑎 = 1, 𝑎1 , 𝑎2 , … , 𝑎𝑁 are weights for the output sequence


and 𝑏 = 𝑏0 , 𝑏1 , 𝑏2 , … , 𝑏𝑀 are weights for the input sequence.
• For FIR filter, 𝑎 = 1, 0, 0, … , 0 = 1.
• Thus, designing FIR filter is a process of finding only the filter
coefficients 𝑏.
FIR filter design technique
• Below are the three common methods:

– Windowing technique
– Frequency Sampling technique
– Optimum technique
• In this module, only windowing technique will be discussed. Thus
the following pages are discussing the windowing technique.
Windowing Technique
• For IIR filter design based on bilinear transformation, the filter is
design based on established analog filter such as Butterworth and
Chebyshev filter.
• In contrast, designing FIR filter based on windowing technique is
basically done by truncating ideal filter which is an IIR type (filter
length = ∞) into FIR type. The truncation process is done at time-
domain.
• The result of the truncation process is an even impulse response.
Thus, delay is applied to solve the non-causality of the even impulse
response.
• DTFT is then use to analyze the frequency response characteristic of
the filter such as ripple and transformation bandwidth.
Frequency Response

• 𝐻 𝜔𝑐 = 0.5
𝜔𝑝 +𝜔𝑠
• 𝜔𝑐 =
2
Filter Design Procedure (Step 1)
Step 1
• Determine filter characteristic (𝜔𝑝 , 𝜔𝑠 , 𝜔𝑐 , 𝑀, window function)

• In windowing technique, 𝛿𝑝 , 𝛿𝑠 are determine by the window


function where 𝛿𝑝 = 𝛿𝑠 . Thus the notation is simplified with 𝛿.

• Similar to IIR filter, transition bandwidth of FIR filter depend on the


value of filter order 𝑀. Thus, if 𝑀 is specified, no need to specify 𝜔𝑝
and 𝜔𝑠 and vice versa.
𝜔𝑠 +𝜔𝑝
• 𝜔𝑐 = . This is where 𝐻 𝜔 = 0.5 or at −6.0206 dB
2
Filter Design Procedure (Step 2)
Step 2
• Obtain impulse response of the desired filter (ideal filter)

1 𝑓𝑜𝑟 𝜔 ≤ 𝜔𝑐
• 𝐻𝑑 𝜔 = ቊ
0 𝑓𝑜𝑟 𝜔𝑐 < |𝜔| ≤ 𝜋

1 𝜋
• ℎ𝑑 𝑛 = ‫׬‬−𝜋 𝐻𝑑 𝜔 𝑒 𝑗𝜔𝑛 𝑑𝜔
2

sin 𝜔𝑐 𝑛
𝑓𝑜𝑟 𝑛≠0
• = ቐ 𝜔𝜋𝑛𝑐
𝑓𝑜𝑟 𝑛=0
𝜋
Filter Design Procedure (Step 2)

𝜔𝑐 𝜔𝑐 𝑛
ℎ𝑑 𝑛 = 𝑠𝑖𝑛𝑐
𝜋 𝜋

ωc/π

n
-∞ ∞
Filter Design Procedure (Step 3)
Step 3
• Multiply ℎ𝑑 𝑛 with the chosen window function 𝑤[𝑛].
• This is to reduce the infinite length of signal ℎ𝑑 𝑛 into finite as this
is an FIR filter. Hence, the length of the FIR filter will equals to the
length of the window function.
• Thus the filter length, 𝑁 is equals to 𝑀 + 1 where 𝑀 is the filter
order.
Filter Design Procedure (Step 4)
Step 4
• Delay ℎ[𝑛] with 𝑛𝑑 to obtain a causal impulse response (ℎ 𝑛 = 0
for 𝑛 < 0)
• 𝑛𝑑 can be computed as follow

𝑀
• 𝑛𝑑 =
2

• From there, the impulse response of a causal FIR filter can be


represented as below where 𝑤 𝑛 can be referred to the later
‘Window Function’ slides.

𝑀
• ℎ 𝑛 = ℎ𝑑 𝑛 − .𝑤 𝑛
2
Simplified Steps
• STEP 1: Find cutoff frequency, 𝜔𝑐 .
• STEP 2: Choose order-𝑀 window function, 𝑤 𝑛 based on the
specified filter characteristics. Refer next slide for the list of
the window functions.
• STEP 3: Solve the impulse response,

𝜔𝑐 𝜔𝑐
ℎ𝑛 = 𝑠𝑖𝑛𝑐 𝑛 − 𝑀/2 .𝑤 𝑛 𝑓𝑜𝑟 0 ≤ 𝑛 ≤ 𝑀
𝜋 𝜋
Window Function
Below are few of the window functions with length of 𝑁 (order of 𝑀)

𝑅𝑒𝑐𝑡𝑎𝑛𝑔𝑢𝑙𝑎𝑟: 𝑤 𝑛 = 1, 0≤𝑛≤𝑁−1

2𝜋𝑛
𝐻𝑎𝑚𝑚𝑖𝑛𝑔: 𝑤 𝑛 = 0.54 − 0.46𝑐𝑜𝑠 , 0≤𝑛 ≤𝑁−1
𝑀

1 2𝜋𝑛
𝐻𝑎𝑛𝑛𝑖𝑛𝑔: 𝑤𝑛 = 1 − 𝑐𝑜𝑠 , 0≤𝑛≤𝑁−1
2 𝑀

2𝜋𝑛 4𝜋𝑛
𝐵𝑙𝑎𝑐𝑘𝑚𝑎𝑛: 𝑤 𝑛 = 0.42 − 0.5𝑐𝑜𝑠 − 0.08𝑐𝑜𝑠 ,… 0≤𝑛≤𝑁−1
𝑀 𝑀
Window Function
• Below is the plot of the window function

Rectangular Hamming

Hanning
Blackman

0 𝑀
Window Function
• Ripple and bandwidth of the FIR filter depend on the window
function. The ripple 𝛿 and transition bandwidth ∆𝜔 for several
window functions are listed in table below

Type of window 𝜹 (dB) ∆𝝎


Rectangular -20.9 dB 1.84𝜋/(𝑁)
Hamming -54.5 dB 6.64𝜋/(𝑁)
Hanning -43.9 dB 6.22𝜋/(𝑁)
Blackman -75.3 dB 11.12𝜋/(𝑁)
Example 1
Design a 20th order FIR lowpass filter based on windowing technique
where cutoff frequency of the filter is 𝜔𝑐 = 0.5𝜋 𝑟𝑎𝑑. Design the filter
based on rectangular, Hamming, Hanning and Blackman window.

Solution
Step 1: Find cutoff frequency. From the question, 𝜔𝑐 = 0.5𝜋 𝑟𝑎𝑑,
𝑀 = 20.

Step 2: Rectangular, Hamming, Hanning and Blackman window of


order 20 will be used.
Example 1 (cont.)
Step 3: Solve,
𝜔𝑐 𝜔𝑐
ℎ𝑛 = 𝑠𝑖𝑛𝑐 𝑛 − 𝑀/2 .𝑤 𝑛
𝜋 𝜋

0.5𝜋 0.5𝜋 20
= 𝑠𝑖𝑛𝑐 𝑛− .𝑤 𝑛
𝜋 𝜋 2

= 0.5𝑠𝑖𝑛𝑐 0.5 𝑛 − 10 . 𝑤 𝑛

ℎ 𝑛 = 0.5𝑠𝑖𝑛𝑐 0.5 𝑛 − 10 . 𝑤[𝑛] 𝑓𝑜𝑟 0 ≤ 𝑛 ≤ 20


Example 1 (cont.)
Rectangular Hanning

Hamming Blackman
Example 1 (cont.)
The magnitude spectrum and magnitude dB of these filters are shown
in the following figures.

𝜔(𝜋 𝑟𝑎𝑑)
Example 1 (cont.)

𝜔(𝜋 𝑟𝑎𝑑)
Example 2
Design an FIR lowpass filter based on rectangular window with filter
characteristic below

𝜔𝑝 = 0.2𝜋, 𝜔𝑠 = 0.4𝜋
Solution
Step 1: Find cutoff frequency, 𝜔𝑐 .
0.2𝜋+0.4𝜋
𝜔𝑐 = = 0.3𝜋
2

Step 2: The order of the rectangular window is:


1.84𝜋
∆𝜔 = = 0.4𝜋 − 0.2𝜋 = 0.2𝜋 → 𝑁 = 9.2 ≈ 10
𝑁
Example 2 (cont.)
Step 3: Solve,
𝜔𝑐 𝜔𝑐
ℎ𝑛 = 𝑠𝑖𝑛𝑐 𝑛 − 𝑀/2 .𝑤 𝑛
𝜋 𝜋

0.3𝜋 0.3𝜋 9
= 𝑠𝑖𝑛𝑐 𝑛−
𝜋 𝜋 2

= 0.3𝑠𝑖𝑛𝑐 0.3 𝑛 − 4.5

ℎ 𝑛 = 0.3𝑠𝑖𝑛𝑐 0.3 𝑛 − 4.5 𝑓𝑜𝑟 0 ≤ 𝑛 ≤ 9


= [−0.06, −0.01, 0.09, 0.21, 0.29, 0.29, 0.21, 0.09, −0.01, −0.06]
Example 2 (cont.)

𝑛 𝜔(𝜋 𝑟𝑎𝑑)

𝜔(𝜋 𝑟𝑎𝑑)
Quiz 1
• Design an FIR lowpass filter with below specifications based on
windowing technique:
𝛿 = 0.007
∆𝜔 = 0.6𝜋
𝑀 ≤ 12
𝜔𝑐 = 1.5708
References
1) John G. Proakis, Dimitris K Manolakis, “Digital Signal Processing:
Principle, Algorithm and Applications”, Prentice-Hall, 4th edition
(2006).
2) Sanjit K. Mitra, “Digital Signal Processing-A Computer Based
Approach”, McGraw-Hill Companies, 3rd edition (2005).
3) Alan V. Oppenheim, Ronald W. Schafer, “Discrete-Time Signal
Processing”, Prentice-Hall, 3rd edition (2009).

Anda mungkin juga menyukai