You are on page 1of 24

Digital Signal

Processing
Lecture 11- FIR Filter with windowing
IVAN TANRA
Type of filter
a) Finite Impulse Response (FIR) is a filter whose impulse response is a
finite duration. It settles to zero in finite duration. The difference
equation is define as
𝑀 −1 𝑀 −1
𝑦 ( 𝑛 ) = ∑ 𝑏 𝑘 𝑥 (𝑛− 𝑘) 𝐻 ( 𝑧 )= ∑ 𝑏 𝑘 𝑧 − 𝑘
𝑘= 0 𝑘=0

b) Infinite Impulse Response (IIR) is a filter whose impulse response is


indefinitely and does not become zero. Example of IIR filter is analog
filter that make use of inductor and capacitor
𝑃 𝑄
𝑎𝑜 𝑦 ( 𝑛 )=∑ 𝑏𝑖 𝑥 ( 𝑛−𝑖 ) − ∑ 𝑎 𝑗 𝑦 ( 𝑛− 𝑗 )
𝑃

∑ 𝑏𝑖 𝑧 − 𝑖
𝑖 =0
𝐻 ( 𝑧 )=
𝑖=0 𝑗=1 𝑄

∑ 𝑎𝑗 𝑧
− 𝑗

𝑗 =0
An ideal lowpass filter

is ratio of cut off frequency over


sampling frequency times
An ideal lowpass filter
The signal is anti causal

Can we predict the before signal?


Design of low pass filter
In order to make it casual signal, we introduce delay to the system (),
which is normally at the middle or half of the filter size (N) Hence :

{
𝜔𝑐
𝑛=𝑛0
h ( 𝑛) = 𝜋
sin 𝜔𝑐 (𝑛 − 𝑛 0)
𝑛 ≠ 𝑛0
(𝑛 − 𝑛0 ) 𝜋
High pass filter
High pass filter is the same as original signal minus low pass filter,
hence the impulse response will be

{
𝜔𝑐
1− 𝑛=𝑛 0
h ( 𝑛) = 𝜋
sin 𝜔 𝑐 (𝑛− 𝑛0 )
− 𝑛 ≠ 𝑛0
(𝑛 − 𝑛 0) 𝜋
Band pass filter
Band pass filter is the same as two low pass filter with different
frequency ( and ) substract each other

{
𝜔𝑐 2 𝜔𝑐 1
− 𝑛=𝑛0
h ( 𝑛) = 𝜋 𝜋
sin 𝜔𝑐 2 (𝑛 − 𝑛 0) − sin 𝜔𝑐 1 (𝑛 − 𝑛0 )
𝑛 ≠ 𝑛0
𝑓 𝑐1 𝑓 𝑐2 (𝑛 − 𝑛 0) 𝜋
Band stop filter
Band pass filter is the same as low pass filter () is added with high pass
filter( )

{
𝜔𝑐 1 𝜔𝑐 2
+1− 𝑛=𝑛0
h ( 𝑛) = 𝜋 𝜋
sin 𝜔𝑐 1 (𝑛 −𝑛 0) − sin 𝜔𝑐 2 (𝑛 − 𝑛0 )
𝑛 ≠ 𝑛0
(𝑛 − 𝑛 0) 𝜋

𝑓 𝑐1 𝑓 𝑐2
Frequency response of low
pass filter
Low pass filter

There specification of the low


pass filter will have the form

The transition band will be


between
Low pass filter with
windowing
Factor that effect the filter is:
1. Width of the main lobe
should be narrow
2. Peak side-lobe amplitude
should be small

General properties of windows are:


1. As the length N of window increase, the width of the main lobe decreases
2. Peak side-lobe amplitude of the window is determined by the shape of a window
3. If the window shape decrease the side-lobe amplitude but will increase the width of main
lobe
Type of windowing
Type of windowing
Type of windowing
Frequency response of
window

Hanning Window Hamming Window

Blackman Window
Example Low Pass Filter with
windows (M =61)
Rectangular Hamming

Blackman Kaiser
Step to design filter Using
Windows
1. Determine the windows function that you are going to use based on
the allowable attenuation and table below

2. Determine number of the filter order based on Transition Width


3. Construct h(n) which is h(𝑛)=h𝑑 ( 𝑛 ) 𝑤(𝑛) , where
and w(n) is windows function
Example

1. Stopband attenuation is 0.01 which is equal to -40 dB. We use hanning


window which has quite near value.
2. Transition width is 0.21π -0.19 π =0.02π

3. Construct h(n) based on the formula and number of order


Coding
M=310;
rc=0.1;
for n=1:1:M
h(n)=sin(2*rc*pi*(n-(M/2)))/(n-(M/2))/pi;
w(n)=0.5-0.5*cos(2*pi*n/(M-1)); % window
hd(n)=h(n)*w(n);
end
See given M-file
Exercise
You are given a 20,000 data signal that consist of 3 frequency
(80Hz,150Hz, and 300Hz). The signal is sample at 1000 Hz. You are going
to design:
a) A low pass filter to filter out the high frequency (150 and 300 Hz)
with window method. The allowable attenuation is around 0.001
b) Determine type of window that you are going to use and its filter
order if the transition width is 1 Hz
Submit your matlab/scilab code
Filter by frequency sampling
method
This filter design Is determined by setting the desired frequency
response within the frequency
Example
Design low pass which has a symmetric unit sample responses and a
frequency response that satisfies the conditions

You might also like