filter types analog filters iir and fir filters design.pdf · iir filter design using impulse...
TRANSCRIPT
Filter design
Mohammad Fathi
1
Outline
Filter types Analog filters IIR and FIR filters IIR Impulse invariant Bilinear Applications: speech equalization, ….
FIR Windowing Applications
2
Filter
Any discrete-time system that modifies certain frequencies
Frequency-selective filters pass only certain frequencies
Filters Lowpass Highpass Bandpass Bandstop
3
Lowpass & highpass filter
Low frequency components are passed through the filter while the high-frequency components are attenuated.
keeps high-frequency components and rejects low-frequency components.
4
Lowpass & highpass filter
Passband the frequency range with the amplitude gain of the filter
response being approximately unity. Stopband
The frequency range over which the filter magnitude response is attenuated to eliminate the input signal whose frequency components are within that range.
Transision band the frequency range between the passband and stopband
5
Lowpass & highpass filter
: passband cutoff frequency : stopband cutoff frequency : ripple (fluctuation) of the frequency response in
the passband. : ripple of the frequency response in the stopband.
6
Bandpass filter
The bandpass filter attenuates both low- and high-frequency components while keeping the middle frequency components. Ω : lower stopband cutoff frequency Ω : lower passband cutoff frequency
Ω : higher passband cutoff frequency
Ω : higher stopband cutoff frequency
7
Bandstop (notch) filter
rejects the middle-frequency components and accepts both the low- and the high-frequency components.
8
Continuous-time filters
Butterworth Chebyshev Type I Type II
Ellipitic
9
Butterworth Lowpass Filters
Magnitude response is maximally flat in the pass band. Magnitude response is monotonic in the passband and
stopband. The magnitude-squared function is of the form
N2
c
2c j/j1
1jH
N2
c
2c j/s1
1sH
10
Butterworth Lowpass Filters
There are 2N poles equally spaced in angle on circle of radius .
Poles occurs in pairs,
11
Chebyshev Filters
Type I Equiripplein the passband and monotonic in the stopband
| Ω | ripples between 1 and for 0 ΩΩ
1 and
decreases monotonically for ΩΩ
1
xcosNcosxV /V1
1jH 1N
c2N
22
c
12
Chebyshev Filters
Type II Monotonic in the passband and equiripple in the stopband One approch to design type II filter is to first design type I
filter and then apply the above transformation.
13
Elliptic filter
Equiripple in both passband and stopband
Jacobianellipitic function
14
Digital filters
15
Ideal filters are non causal and nonrealizable
16
17
Discrete-time processing of continuous-time signals
We already studied the use of discrete-time systems to implement a continuous-time system If the input is band limited and the sampling frequency is high
to avoid aliasing, then the overall system behaves as a LTI continuous-time system.
If our specifications are given in continuous time we can obtain discrete-time specifications.
/ jeff
T
H e H j T
18
Filter Specifications Specifications Passband
Stopband
Parameters
Specs in dB Ideal passband gain =20log(1) = 0 dB Max passband gain = 20log(1.01) = 0.086dB Max stopband gain = 20log(0.001) = -60 dB
200020 01.1jH99.0 eff
30002 001.0jHeff
1
24
4
0.010.001
2 2000 2 2000 (10 ) 0.4
2 3000 2 3000 (10 ) 0.6p p
s s
Filter implementation
all kinds of digital filters are implemented using FIR or IIR systems. Infinite impulse response (IIR)
finite impulse response (FIR)
19
IIR or FIR?
Compared with FIR filter, the IIR filter offers a much smaller filter size. Filter operation requires a fewer number of computations. Not linear phase
FIR Linear phase much higher filter order than IIR filters
the design methods often are iterative in nature requiring computer-aided techniques.
20
Filter design
Filter Design Steps Specification
Problem or application specific
Approximation of specification with a discrete-time system Our focus is to go from spec to discrete-time system
Implementation Realization of discrete-time systems depends on target technology
21
IIR filter design
22
IIR
The techniques for the design of standard frequency selective discrete-time IIR filters are based on well-developed continuous-time filter design methods. Impulse invariant Bilinear transformation
23
IIR filter design using impulse invariant
Sampling the impulse response of continuous-time filter. it preserves the shape of the impulse response.
If the continuous-time filter is bandlimited to
Continuous-time and discrete-time frequencies are related by the linear scaling = Td .
Because of the aliasing effect, the impulse-invariance method is only meaningful for bandlimited filters, like lowpass and bandpass filters.
2jd c d c
k d d
h n T h nT H e H j j kT T
0 / jc d c
d
H j T H e H jT
24
25
Impulse Invariance of System Functions Consider the CT system function with partial fraction
expansion
Corresponding impulse response
Impulse response of discrete-time filter
Then, DT system function is
Pole s=sk in s-domain transform into pole at
N
1k k
kc ss
AsH
0t0
0teAthN
1k
tsk
c
k
N
1k
nTskd
N
1k
nTskddcd nueATnueATnThTnh dkdk
N
1k1Ts
kd
ze1ATzH
dk
dkTse
Not one-to-one mapping
Ω Ω
ΩΩ
= Ω
A strip of height 2π/Td is mapped into the entire z-plane.26
27
Example Impulse invariance applied to Butterworth
Since sampling rate Td cancels out we can assume Td=1 Map spec to continuous time
Butterworth filter is monotonic so spec will be satisfied if
Determine N and c to satisfy these conditions
3.0 0.17783eH
2.00 1eH89125.0j
j
3.0 0.17783jH
2.00 1jH89125.0
0.17783 3.0jH and 89125.0 2.0jH cc
N2
c
2c j/j1
1jH
28
Example Cont’d
Satisfy both constrains
Solve these equations to get
Poles of transfer function
2N2
c
2N2
c 17783.013.01 and
89125.012.01
70474.0 and 68858.5N c
0,1,...,11kfor ej1s 11k212/jcc
12/1k
Example Cont’d
For causality and stability, we select poles in the left half of s-plane.
29
Example Cont’d
The transfer function
Mapping to z-domain
4945.0s3585.1s4945.0s9945.0s4945.0s364.0s12093.0sH 222
21
1
21
1
21
1
z257.0z9972.01z6303.08557.1
z3699.0z0691.11z1455.11428.2
z6949.0z2971.11z4466.02871.0zH
30
31
Freq. response
Bilinear transformation
To avoid the limitations of impulse-invariance transformation caused by the aliasing effect,
we need a one-to-one mapping from the s-plane to the z-plane.
The bilinear transformation is an invertible nonlinear mapping between the s-plane and the z-plane defined by
32
33
Filter Design by Bilinear Transformation Avoid the aliasing problem of impulse invariance Map the entire jΩ-axis in the s-plane to one revolution of the unit-circle
in the z-plane. Nonlinear transformation Frequency response subject to warping
Bilinear transformation
Transformed system function
We can solve the transformation for z as
1
1
d z1z1
T2s
1
1
dc z1
z1T2HzH
2/Tj2/T1
2/Tj2/T1s2/T1s2/T1z
dd
dd
d
d
js
Maps the left-half s-plane into the inside of the unit-circle in z Causal Stable continuous-time filter map into the causal stable discrete-time
filter
34
35
Bilinear Transformation
On the unit circle the transform becomes
To derive the relation between and
Which yields
j
d
d e2/Tj12/Tj1z
2tan
Tj2
2/cose22/sinje2
T2j
e1e1
T2s
d2/j
2/j
dj
j
d
2Tarctan2or
2tan
T2 d
d
36
Bilinear Transformation
Design method
37
38
Example Bilinear transform applied to Butterworth
Apply bilinear transformation to specifications
We can assume Td=1 and apply the specifications to
To get
3.0 0.17783eH
2.00 1eH89125.0j
j
23.0tan
T2 0.17783jH
22.0tan
T20 1jH89125.0
d
d
N2
c
2c /1
1jH
2N2
c
2N2
c 17783.0115.0tan21 and
89125.011.0tan21
39
Example Cont’d Solve N and c
The resulting transfer function has the following poles
Resulting in
Applying the bilinear transform yields
6305.51.0tan15.0tanlog2
189125.0
1117783.0
1log
N
22
766.0c
0,1,...,11kfor ej1s 11k212/jcc
12/1k
5871.0s4802.1s5871.0s0836.1s5871.0s3996.0s20238.0sH 222c
21
2121
61
z2155.0z9044.011
z3583.0z0106.11z7051.0z2686.11z10007378.0zH
40
Example Cont’d
Design example
low pass filter Specifications
Butterworth filter N=14
41
Design example
Chebyshev type I N=8
Chebyshev type II N=8
42
Design example
Elliptic filter N=6
For a fixed specifications, the lowest order filter is obtained when the approximation error ripples equally between the extremes of the two bands.
43
Frequency transformation of lowpass IIR filters
Design highpass, bandpass and bandstop filters first design a low pass filter. then using an algebraic transformation, derive the desired filter.
44
45
FIR filter design
46
FIR filter
Linear phase Window method Simplest way of designing FIR filters Start with ideal desired frequency response
Ideal impulse responses are noncausal and of infinite length The easiest way to obtain a causal FIR filter from ideal is to
truncate the ideal impulse response.
n
njd
jd enheH
deeH21nh njj
dd
else0
Mn0nhnh d
else0
Mn01nw where nwnhnh d
47
Windowing in frequency domain Windowed frequency response
The windowed version is smeared version of desired response
If w[n]=1 for all n, then W(ej) is pulse train with 2 period
deWeH21eH jj
dj
48
Properties of Windows
It is desired that is concentrated in a narrow band of frequency to have Less
smearing. is as short as possible in duration to minimize computation in
implementing of the filter.
These are conflicting requirements! Example: Rectangular window
0
1/2 sin 1 / 21
1 sin / 2
Mj j n
n
j Mj M
j
W e e
Me ee
else0
Mn01nw
49
Rectangular window
By tapering the window smoothly to zero at each end, the height of the sidelobs can be diminished. This is achieved at the expense of a wider mainlob and a wider
transition at the discontinuity.
Narrowest main lob 4/(M+1) Sharpest transitions at
discontinuities in frequency
Large side lobs -13 dB Large oscillation around
discontinuities
50
Bartlett (Triangular) Window Medium main lob 8/M
Side lobs -25 dB
Hamming window performs better
Simple equation
else0Mn2/MM/n222/Mn0M/n2
nw
51
Hanning Window
Medium main lob 8/M
Side lobs -31 dB
Hamming window performs better
Same complexity as Hamming
else0
Mn0Mn2cos1
21
nw
52
Hamming Window• Medium main lob
8/M
• Good side lobs -41 dB
• Simpler than Blackman
else0
Mn0Mn2cos46.054.0nw
53
Blackman Window
• Large main lob 12/M
• Very good side lobs -57 dB
• Complex equation
else0
Mn0M
n4cos08.0Mn2cos5.042.0nw
54
Some properties
55
Non rectangular windows have wider main lobes and lower sidelobes.
The width of transition band which is controlled by the width of the mainlob can be reduced by increasing the order M of the filter.
56
Generalized Linear Phase
It is desirable to obtain causal systems with linear phase.
All windows are symmetric about point M/2.
/2 /2
00
[ ] [ / 2] ( ) ( ) jw jw jwM j j j Me e e
w M n n Mw n
else
w n w n M W e W e e W e W e e
where is a real and even function of is linear phase. j jeW e W e
/2
if [ ] [ ] [ ] [ ] [ ] Linear phase
d d d
j j j Me
h M n h n h n h n w n
H e H e e
57
Linear-Phase Lowpass filter Desired linear phase response
Corresponding impulse response
Using a symmetric window, then a linear phase system will result.
c
c2/Mj
jlp 0
eeH
2/Mn
2/Mnsinnh clp
nw
2/Mn2/Mnsinnh c
58
Some notes
59
Peak overshoot δ. Peak undershoot δ. Distance between the peak ripples is approximately
the mainlobe width.
Design procedure
60
Determine the cut-off frequency: Determine From the table choose the window function that provides the
smallest stopband attenuation greater than A. For this window, determine the required value of M by
selecting the corresponding value of ∆w. If M is odd, we may increase it by one to have flexible filter. Determine the impulse response of the ideal lowpass filter by
Compute
( ) / 2c p sw w w= +
1020 log , .s pA w w wd= - D = -
[ ] [ ] [ ]dh n h n w n=
Example
61
Specification
Hamming window M= 80 approximately, M=66 exactly
0.25 , 0.35 , 0.0032p sw wp p d= = =
0.3 , 0.1 , 50cw Ap w p = D = =
Typical application: speech noise reduction
62
Typical application: speech noise reduction
63
64
Impulse response of standard FIR filters
65
Low pass
High pass
Bandpass
Bandstop
0Low pass: [ ]
sin( ) 0
1 0High pass: [ ]
sin( ) 0
0Band pass: [ ]
sin( ) sin( ) 0
1 0Band stop: [ ]
sin( ) sin
c
c
c
c
H L
H L
H L
H
nh n
n nn
nh n
n nn
nh n
n n nn n
nh n
nn
( ) 0Ln nn
Copyright (C) 2005 Güner66
Kaiser Window Filter Parameterized equation
forming a set of windows Parameter to change main-lob
width and side-lob area trade-off
I0(.) represents zeroth-order modified Bessel function of 1st
kind
else0
Mn0I
2/M2/Mn1I
nw0
2
0
67
Determining Kaiser Window Parameters
Given filter specifications Kaiser developed empirical equations Given the peak approximation error or in dB as A=-20log10 and transition band width
The shape parameter should be
The filter order M is determined approximately by
21A050A2121A07886.021A5842.0
50A7.8A1102.04.0
ps
285.2
8AM
68
Example: Kaiser Window Design of a Lowpass Filter
Specifications Window design methods assume Determine cut-off frequency Due to the symmetry we can choose it to be
Compute
And Kaiser window parameters
Then the impulse response is given as
001.0,01.0,6.0,4.0 21pp
001.021
5.0c
2.0ps 60log20A 10
653.5 37M
else0
Mn0653.5I
5.185.18n1653.5I
5.18n5.18n5.0sinnh
0
2
0
69
Example Cont’d
Approximation Error
Example
70
Specification 0.25 , 0.35 , 0.0032p sw wp p d= = =
0.3 , 0.1 , 50
4.5, 59 60cw A
M
p w pb
= D = = = =
71
General Frequency Selective Filters
A general multiband impulse response can be written as
Window methods can be applied to multiband filters Example multiband frequency response Special cases of
Bandpass Highpass Bandstop
mbN
1k
k1kkmb 2/Mn
2/MnsinGGnh
Filter design tool
72
References
73
Discrete-Time Signal Processing, 2e by Oppenheim, Shafer
Lecture notes by Güner Arslan Dept. of Electrical and Computer Engineering, The University of Texas at Austin