7/31/2019 Chapt 4 Design of Digital Filters_FIR
1/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 1
Chapt 04
Design of Digital Filters ( FIR)B.E. Comps, Mumbai Uni
PrePrepared by Chandrashekhar Padole
Lecturer
Watumull Institute of Tech , Worli
7/31/2019 Chapt 4 Design of Digital Filters_FIR
2/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 2
Chapt 04 Design of Digital Filters
Design of FIR filters
Design of IIR filters from analog filters
Frequency transformation
Design of digital filters based on least-squares method
Digital filters from analog filters
Properties of FIR filters
Design of FIR filters using windows
Comparison of IIR and FIR filters
Linear phase filters
7/31/2019 Chapt 4 Design of Digital Filters_FIR
3/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 3
What is filter ?
Basic building block of DSP:Input is given to filter and output of the system would be
signal obtained from input and filter's impulse response.
FilterInput Output
[ 1 1]Input Output
[ 1 -1]Input Output
Integrator ( Lowpass filter)
Differentiator(High pass filter)
7/31/2019 Chapt 4 Design of Digital Filters_FIR
4/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 4
Contd..
Different impulse response different characteristics
Characteristic of the filter Frequency domain characteristics
FrequencyCharacteristic
PhaseCharacteristic
7/31/2019 Chapt 4 Design of Digital Filters_FIR
5/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 5
Frequency Characteristic
H(w)
W
Frequency characteristic plot between frequencies and magnitude
For given system if particular frequency is passed thorough the system,its magnitude at output can be obtained from corresponding magnitudefrom frequency characteristicNote: most of the time input wont be single pure sinusoidal/frequency but
would be a set of frequencies
7/31/2019 Chapt 4 Design of Digital Filters_FIR
6/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 6
Phase Characteristic
(w)
W
Phase characteristic plot between frequencies and phase shift
For given system if particular frequency is passed thorough the system,its delay/phase shift at output can be obtained from corresponding phsefrom phase characteristicNote: most of the time input wont be single pure sinusoidal/frequency butwould be a set of frequencies
7/31/2019 Chapt 4 Design of Digital Filters_FIR
7/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 7
Ideal Characteristics
Frequency Phase
Sharp cutoffLinear
phase
Sharp cutoff is requirement foralmost all the applications
Non-linear phase characteristicdistorts the signal.Linear phase characteristic has
constant group delay.
7/31/2019 Chapt 4 Design of Digital Filters_FIR
8/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 8
Effect of Linear Phase Characteristic
Let us pass signal , made up of summing frequency 1 Hz, 2Hz & 3Hz, through filters with different phase characteristics
7/31/2019 Chapt 4 Design of Digital Filters_FIR
9/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 9
Contd..
7/31/2019 Chapt 4 Design of Digital Filters_FIR
10/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 10
Contd..
7/31/2019 Chapt 4 Design of Digital Filters_FIR
11/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 11
Contd..
7/31/2019 Chapt 4 Design of Digital Filters_FIR
12/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 12
Contd..
7/31/2019 Chapt 4 Design of Digital Filters_FIR
13/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 13
Contd..
7/31/2019 Chapt 4 Design of Digital Filters_FIR
14/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 14
Challenge ..
7/31/2019 Chapt 4 Design of Digital Filters_FIR
15/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 15
Verify .
7/31/2019 Chapt 4 Design of Digital Filters_FIR
16/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 16
M file used in MATLAB for this simulation
clear all;close all;figure,
subplot(4,1,1);plot(sin(2*pi*1*[0:0.01:3]));title(' Inoput Signal Composition');subplot(4,1,2);
plot(sin(2*pi*2*[0:0.01:3]));subplot(4,1,3);plot(sin(2*pi*3*[0:0.01:3]));
subplot(4,1,4);plot(sum([sin(2*pi*1*[0:0.01:3]);sin(2*pi*2*[0:0.01:3]);sin(2*pi*3*[0:0.01:3])]));
figure,subplot(4,1,1);plot(sin(2*pi*1*[0:0.01:3]+pi/8));title(' Filtered Signal with phase characteristic pi/8');subplot(4,1,2);plot(sin(2*pi*2*[0:0.01:3]+pi/8));subplot(4,1,3);plot(sin(2*pi*3*[0:0.01:3]+pi/8));
subplot(4,1,4);plot(sum([sin(2*pi*1*[0:0.01:3]+pi/8);sin(2*pi*2*[0:0.01:3]+pi/8);sin(2*pi*3*[0:0.01:3]+pi/8)]));
7/31/2019 Chapt 4 Design of Digital Filters_FIR
17/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 17
Contd..
figure,subplot(4,1,1);plot(sin(2*pi*1*[0:0.01:3]+pi/4));title(' Filtered Signal with phase characteristic pi/4');subplot(4,1,2);plot(sin(2*pi*2*[0:0.01:3]+pi/4));subplot(4,1,3);
plot(sin(2*pi*3*[0:0.01:3]+pi/4));
subplot(4,1,4);plot(sum([sin(2*pi*1*[0:0.01:3]+pi/4);sin(2*pi*2*[0:0.01:3]+pi/4);sin(2*pi*3*[0:0.01:3]+pi/4)]));
figure,subplot(4,1,1);
plot(sin(2*pi*1*[0:0.01:3]+pi/2));title(' Filtered Signal with phase characteristic pi/2');subplot(4,1,2);plot(sin(2*pi*2*[0:0.01:3]+pi/2));subplot(4,1,3);plot(sin(2*pi*3*[0:0.01:3]+pi/2));
subplot(4,1,4);
plot(sum([sin(2*pi*1*[0:0.01:3]+pi/2);sin(2*pi*2*[0:0.01:3]+pi/2);sin(2*pi*3*[0:0.01:3]+pi/2)]));
7/31/2019 Chapt 4 Design of Digital Filters_FIR
18/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 18
Contd..
figure,subplot(4,1,1);plot(sin(2*pi*1*[0:0.01:3]+pi/8));title(' Filtered Signal with phase characteristic w(linear phase with group delay 1)');subplot(4,1,2);plot(sin(2*pi*2*[0:0.01:3]+pi/4));subplot(4,1,3);
plot(sin(2*pi*3*[0:0.01:3]+pi/2));
subplot(4,1,4);plot(sum([sin(2*pi*1*[0:0.01:3]+pi/8);sin(2*pi*2*[0:0.01:3]+pi/4);sin(2*pi*3*[0:0.01:3]+pi/2)]));
figure,subplot(4,1,1);
plot(sin(2*pi*1*[0:0.01:3]+pi/4));title(' Filtered Signal with phase characteristic 2w(linear phase with group delay 2)');subplot(4,1,2);plot(sin(2*pi*2*[0:0.01:3]+pi/2));subplot(4,1,3);plot(sin(2*pi*3*[0:0.01:3]+pi/1));
subplot(4,1,4);
plot(sum([sin(2*pi*1*[0:0.01:3]+pi/4);sin(2*pi*2*[0:0.01:3]+pi/2);sin(2*pi*3*[0:0.01:3]+pi/1)]));
7/31/2019 Chapt 4 Design of Digital Filters_FIR
19/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 19
Chapt 04
figure,
subplot(6,1,1);plot(sum([sin(2*pi*1*[0:0.01:3]);sin(2*pi*2*[0:0.01:3]);sin(2*pi*3*[0:0.01:3])]));title('I am Input Signal , which of followings looks like me ?');
subplot(6,1,2);plot(sum([sin(2*pi*1*[0:0.01:3]+pi/8);sin(2*pi*2*[0:0.01:3]+pi/8);sin(2*pi*3*[0:0.01:3]+pi/8)]));%title(' Filtered Signal with phase characteristic pi/8');
subplot(6,1,3);plot(sum([sin(2*pi*1*[0:0.01:3]+pi/4);sin(2*pi*2*[0:0.01:3]+pi/4);sin(2*pi*3*[0:0.01:3]+pi/4)]));%title(' Filtered Signal with phase characteristic pi/4');
subplot(6,1,4);plot(sum([sin(2*pi*1*[0:0.01:3]+pi/2);sin(2*pi*2*[0:0.01:3]+pi/2);sin(2*pi*3*[0:0.01:3]+pi/2)]));%title(' Filtered Signal with phase characteristic pi/2');
subplot(6,1,5);plot(sum([sin(2*pi*1*[0:0.01:3]+pi/8);sin(2*pi*2*[0:0.01:3]+pi/4);sin(2*pi*3*[0:0.01:3]+pi/2)]));%title(' Filtered Signal with phase characteristic w(linear phase with group delay 1)');
subplot(6,1,6);plot(sum([sin(2*pi*1*[0:0.01:3]+pi/4);sin(2*pi*2*[0:0.01:3]+pi/2);sin(2*pi*3*[0:0.01:3]+pi/1)]));%title(' Filtered Signal with phase characteristic 2w(linear phase with group delay 2)');
7/31/2019 Chapt 4 Design of Digital Filters_FIR
20/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 20
Chapt 04
figure,
subplot(6,1,1);plot(sum([sin(2*pi*1*[0:0.01:3]);sin(2*pi*2*[0:0.01:3]);sin(2*pi*3*[0:0.01:3])]));title(' Input Signal ');
subplot(6,1,2);plot(sum([sin(2*pi*1*[0:0.01:3]+pi/8);sin(2*pi*2*[0:0.01:3]+pi/8);sin(2*pi*3*[0:0.01:3]+pi/8)]));title(' Filtered Signal with phase characteristic pi/8');
subplot(6,1,3);plot(sum([sin(2*pi*1*[0:0.01:3]+pi/4);sin(2*pi*2*[0:0.01:3]+pi/4);sin(2*pi*3*[0:0.01:3]+pi/4)]));title(' Filtered Signal with phase characteristic pi/4');
subplot(6,1,4);plot(sum([sin(2*pi*1*[0:0.01:3]+pi/2);sin(2*pi*2*[0:0.01:3]+pi/2);sin(2*pi*3*[0:0.01:3]+pi/2)]));title(' Filtered Signal with phase characteristic pi/2');
subplot(6,1,5);plot(sum([sin(2*pi*1*[0:0.01:3]+pi/8);sin(2*pi*2*[0:0.01:3]+pi/4);sin(2*pi*3*[0:0.01:3]+pi/2)]));
title(' Filtered Signal with phase characteristic w(linear phase with group delay 1)');
subplot(6,1,6);plot(sum([sin(2*pi*1*[0:0.01:3]+pi/4);sin(2*pi*2*[0:0.01:3]+pi/2);sin(2*pi*3*[0:0.01:3]+pi/1)]));title(' Filtered Signal with phase characteristic 2w(linear phase with group delay 2)');
7/31/2019 Chapt 4 Design of Digital Filters_FIR
21/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 21
Linear Phase Conclusion
If filter doesn't have linear phase characteristic( constant groupdelay) then signal shape gets distorts.e.g. First 3 filtered outputs
If filter has linear phase characteristic( constant group delay) thensignal shape would be preserved.e.g. Last 2 filtered outputs
Linear phase can be obtained easily by FIR filter by having
symmetric/anti-symmetric property in its impulse response.
7/31/2019 Chapt 4 Design of Digital Filters_FIR
22/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 22
FIR Filter
FIR filter has finite number of samples in its impulse response
Advantages:
The question of stability and realizability never arise for FIR filters ( it isalways stable and realizable) It gives linear phase relationship with frequency , which can beachieved by having symmetric or anti-symmetric impulse response of thefilter
Disadvantages :
Long sequences for h(n) are generally required to adequatelyapproximate sharp cut-off filters
Hence , higher computation complexityThe delay of linear phase FIR filters need not always be an integer
number of samples . This non-integral delays can lead to problems insome signal processing applications
7/31/2019 Chapt 4 Design of Digital Filters_FIR
23/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 23
Characteristic of FIR filter
Let { h(n)} be a causal finite durations sequence of length N( 0 to N-1).Its z-transform
=
=
1
0
)()(N
n
nznhzH --------(1)
Its Fourier transform,
=
=
1
0
)()(N
n
jwnjwenheH
Which is periodic in frequency with period of 2
)()()2( mjj
eHeH +
= ......3,2,1,0 =mfor
--------(2)
Consider h(n) be real and its magnitude and phase ,
)()()(
jjwjweeHeH =
7/31/2019 Chapt 4 Design of Digital Filters_FIR
24/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 24
Contd..
From eq (2) , since wnjwne jwn sincos =
symmetricAnti-
symmetric
Magnitude of Fourier transform is symmetric and the phaseis an anti-symmetric function
)()(jwjw
eHeH
=
0)()( =
Consider , we have to have linear phase responsei.e. =)(
where is constant ( phase delay in samples)
7/31/2019 Chapt 4 Design of Digital Filters_FIR
25/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 25
Contd..
We would find , condition/restriction on impulse response such that itwill give linear phase response
Mathematically,
=
=
1
0
)()(N
n
jwnjwenheH
jjweeH
= )( Requirement
=
=
1
0)()(
N
n
jwnjw
enheH
Given
=
=
=
1
0
1
0 )sin()()cos()(
N
n
N
n wnnhjwnnh
=
=
=
1
0
1
01
)cos()(
)sin()(
tanN
n
N
n
wnnh
wnnh
7/31/2019 Chapt 4 Design of Digital Filters_FIR
26/67
Since n=0, sin(wn)=0Hence , limit starts
from 1
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 26
Contd..
=
=
=
1
0
1
0
)cos()(
)sin()(
)tan(N
n
N
n
wnnh
wnnh
+
=
=
=
1
1
1
1
)cos()()0(
)sin()(
)tan(N
n
N
n
wnnhh
wnnh
There are two possible solutions
1) =0 , h(0) can be arbitrary& h(n)=0 for n0
In this case filter will have order 0 and it would bejust amplifier and not a filter. This is not toouseful result
7/31/2019 Chapt 4 Design of Digital Filters_FIR
27/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 27
Contd..
2) 0
==
=
=
1
0
1
0
)cos()(
)sin()(
)cos(
)sin()tan(
N
n
N
n
nnh
nnh
=
=
=
1
0
1
0
)cos()sin()()sin()cos()(N
n
N
n
nnhnnh
0)}cos()sin()sin()){cos((
1
0=
= nnnh
N
n
0)sin()(1
0
=
=
nnhN
n
0)(sin)(1
0
=
=
nnhN
n
7/31/2019 Chapt 4 Design of Digital Filters_FIR
28/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 28
Contd..
From this equation , unique solution is obtained for the set ofconditions
1) = (N-1)/2i.e. for any value of sequence , there is only one value of phase delay
, which is the condition to obtain linear phase.2) h(n)=h(N-1-n) for 0 n N-1i.e. impulse response sequence must have a special kind of symmetry
for the value of
For linear phase filter , impulse response should be either symmetric oranti-symmetric.As impulse response can be of odd or even length, there are four
possible types of impulse response which will have linear phasecharacteristic.
7/31/2019 Chapt 4 Design of Digital Filters_FIR
29/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 29
Linear Phase Filters Impulse Responses
1) Symmetric and Even N
2) Anti-symmetric and Even N
3) Symmetric and Odd N
4) Anti-symmetric and Odd N
7/31/2019 Chapt 4 Design of Digital Filters_FIR
30/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 30
Symmetric and Even & Odd N
0 1 2 3 4 5 6 7 8 9 10
N=11 ( Odd)= 5
Center ofsymmetry
0 1 2 3 4 5 6 7 8 9
N=10 ( Even)= 4.5
Center ofsymmetry
7/31/2019 Chapt 4 Design of Digital Filters_FIR
31/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 31
Anti-Symmetric and Even & Odd N
0 1 2 3 4 5 6 7 8 9 10
N=11 ( Odd)= 5
Center of
symmetry
0 1 2 3 4 5 6 7 8 9
N=10 ( Even)= 4.5
Center ofsymmetry
P f f Li h h i i f ll f
7/31/2019 Chapt 4 Design of Digital Filters_FIR
32/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 32
Proofs of Linear phase characteristics for all four types
Refer Rabinar and Gold
P iti f i Li h filt
7/31/2019 Chapt 4 Design of Digital Filters_FIR
33/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 33
Position of zeros in Linear phase filters
=
=
1
0
)()(N
n
nznhzHWe have
)1()2()3(
4321
)0()1()2(
)4()3()2()1()0(
++++=
NNN zhzhzh
zhzhzhzhh
Symmetry/ anti-symmetry in impulse response
2/)1()(
=
NzzH [ ]
[ ]
[ ]})2(
)1(
)0({
2/)5(2/)5(
2/)3(2/)3(
2/)1(2/)1(
+
+
+
NN
NN
NN
zzh
zzh
zzh
-----------(1)
C td
7/31/2019 Chapt 4 Design of Digital Filters_FIR
34/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 34
Contd..
If z is replaced by z-1 in eq 1 we get
2/)1(1)(
=
NzzH [ ]
[ ][ ]
}
)2(
)1(
)0({
2/)5(2/)5(
2/)3(2/)3(
2/)1(2/)1(
+
+
+
NN
NN
NN
zzh
zzh
zzh
-----------(2)
Comparing eq 1 & 2 we get
)()()1(1 zHzzH N =
H(z) and H(z
-1
) are identical within adelay of (N-1) samples and multiplier 1(r,-)
(r,)
(1/r,)
(1/r,-)
Id l Filt
7/31/2019 Chapt 4 Design of Digital Filters_FIR
35/67
2/2/2012Watumull Institute of Technology, Worli
Prepared by Chandrashekhar Padole, DSP-BE Computer, Mumbai Uni 35
Ideal Filter
Consider ideal low-pass filter characteristic
H(w)
Wc w
=0
1)(H
)(
~
kH2/3
Top Related