Chapter 9 Analysis and Design of Digital Filterymzhang/EE422/EE422-9.doc · Web viewChapter 9...
Transcript of Chapter 9 Analysis and Design of Digital Filterymzhang/EE422/EE422-9.doc · Web viewChapter 9...
EE 422G Notes: Chapter 9 Instructor: Zhang
Chapter 9 Analysis and Design of Digital Filter
9-1 Introduction
What designs have we done in this course? What do we mean by filters here? What do we mean by filters design?
Given specifications (requirements) => H(z)
Let’s see how we can implement a digital filter (processor) if its H(z) is given?
9-2 Structures of Digital Processors
1. Direct-Form Realization
The function is realized! What’s the issue here?
Count how many memory elements we need!
Page 9-1
EE 422G Notes: Chapter 9 Instructor: Zhang
Can we reduce this number?If we can, what is the concern?
Denote Implement H2(z) and then H1(z) ?
Why H2 is implemented?(1)
(2)
H2 is realized!
Can you tell why H1 is realized?
Page 9-2
EE 422G Notes: Chapter 9 Instructor: Zhang
What can we see from this realization? Signals at and : always the same Direct Form II Realization
Example
Solution:
Page 9-3
EE 422G Notes: Chapter 9 Instructor: Zhang
Important: H(z)=B(z)/A(z) (1) A: 1+…. (2) Coefficients in A: in the feedback channel
2. Cascade Realization
Factorize
General Form
Apply Direct II for each!
3. Parallel Realization (Simple Poles)
Page 9-4
EE 422G Notes: Chapter 9 Instructor: Zhang
Example 9-1
cascade and parallel realization!Solution:
(1)Cascade:
(2)Parallel
In order to make deg(num)<deg(den)
Page 9-5
Partial-Fraction Expansion for s
EE 422G Notes: Chapter 9 Instructor: Zhang
z = anything other than 0, ½, 1/8, 1 B = -112 For example, z=2
Example 9-2: System having a complex conjugate pole pair at Transfer function
Page 9-6
EE 422G Notes: Chapter 9 Instructor: Zhang
How do we calculate the amplitude response and ?
How the distance between the pole and the unit circle influence |H| and H ?
How the distance between the pole and the unit circle influence ?
How the pole angle influence and ?
See Fig. 9-7
Page 9-7
EE 422G Notes: Chapter 9 Instructor: Zhang
Page 9-8
EE 422G Notes: Chapter 9 Instructor: Zhang
HW: 9-2(a), 9-11, 9-13, 9-14
Page 9-9
EE 422G Notes: Chapter 9 Instructor: Zhang
9-3 Discrete-Time Integration
A method of Discrete-time system Design: Approximate continuous-time system Integrator a simple system system input Output
Discrete-time approximation of this system: discrete-time Integrator
1. Rectangular Integration change of y from t0 to t :
t = nT, t0 = nT- T
T small enough =>
A discrete-time integrator: rectangular integrator
Page 9-10
Constant
Constant y(nT) : System outputx(nT) : System input , to be integrated
EE 422G Notes: Chapter 9 Instructor: Zhang
2. Trapezoidal Integration
or
3. Frequency Characteristics
3.1 Rectangular Integrator
Frequency Response
Or
Page 9-11
Constants
EE 422G Notes: Chapter 9 Instructor: Zhang
Amplitude Response Phase Response
3.2 Trapezoidal Integrator
Frequency Response
Amplitude: Phase:
3.3 Versus Ideal IntegratorIdeal (continuous-time ) Integrator
when T=1 second (Different plots and relationships will result if T is different.)
Page 9-12
EE 422G Notes: Chapter 9 Instructor: Zhang
Low Frequency Range (Frequency of the input is much lower than the sampling frequency: It should be!)
High Frequency: Large error (should be)
Example 9-4 Differential equation (system)
Page 9-13
EE 422G Notes: Chapter 9 Instructor: Zhang
Determine a digital equivalent.
Solution (1) Block Diagram of the original system (2) An equivalent (3) Transfer Function Derivation
Design: 9-4 Find Equivalence of a given analog filter (IIR): Including methods in Time Domain and Frequency Domain.
9-5 No analog prototype, from the desired frequency response: FIR 9-6 Computer-Aided Design
Page 9-14
EE 422G Notes: Chapter 9 Instructor: Zhang
9-4 Infinite Impulse Response (IIR) Filter Design (Given H(s) Hd(z) )
9-4A Synthesis in the Time-Domain: Invariant Design1. Impulse – Invariant Design(1) Design Principle
(2) Illustration of Design Mechanism (Not General Case)Assume:
(1) Given analog filter (Transfer Function)
(a special case)
(2) Sampling Period T (sample ha(t) to generate ha(nT))
Derivation:(1) Impulse Response of analog filter
(2) ha(nT): sampled impulse response of analog filter
(3) z-transform of ha(nT)
Page 9-15
EE 422G Notes: Chapter 9 Instructor: Zhang
Sampled impulse response of analog filter
(4) Impulse-Invariant Design Principle
Digital filter is so designed that its impulse response h(nT)equals the sampled impulse response of the analog filter ha(nT)
Hence, digital filter must be designed such that
(5) (scaling)
=>
(3) Characteristics(1) when T 0 frequency response of digital filter
(2)
(3) Design: Optimized for T = 0 Not for T 0 (practical case) (due to the design principle)
(4) Realization: Parallel
Page 9-16
z-transfer function of the digital
filter. Of course,the z-transfer function of its impulse response.
EE 422G Notes: Chapter 9 Instructor: Zhang
(5) Design Example Solution:
2. General Time – Invariant Synthesis(1) Design Principle
(2)
Derivation
Page 9-17
EE 422G Notes: Chapter 9 Instructor: Zhang
Given: Ha(s) transfer function of analog filterXa(s) Lapalce transform of input signal of analog Filter
T sampling periodFind H(z) z-transfer function of digital filter
(1) Response of analog filter xa(t)
(2) ya(nT) sampled signal of analog filter output
(3) z-transform of ya(nT)
(4) Time – invariant Design Principle
Digital filter is so designed that its output equals the sampledoutput of the analog filter
Incorporate the scaling :
z-transfer function of digital filter
(5) Design Equation
special case X(z)=1, Xa(s) = 1 (impulse) => (6) Design procedure
A: Find (output of analog filter) B: Find C: Find D:
Example 9-5
Find digital filter H(z) by impulse - invariance. Solution of design:
(1) Find
Page 9-18
T
EE 422G Notes: Chapter 9 Instructor: Zhang
(2) Find
(3) Find
(4) Find z-transfer function of the digital filter
use G = T
(5) Implementation
Characteristics
(1) Frequency Response equations: analog and digital
Analog :
Digital :
(2) dc response comparison ( )
Page 9-19
EE 422G Notes: Chapter 9 Instructor: Zhang
Analog:
Digital:
Varying with T (should be)
,
for example , good enough
(3) versus : Using normalized frequency
Page 9-20
EE 422G Notes: Chapter 9 Instructor: Zhang
(4) versus
(5) Gain adjustment when => frequency response inequality
adjust G => at a special for example
If G = T = 0.3142 => If selecting G = T/1.0745 =>
3. Step – invariance synthesis
Example 9-6 . Find its step-invariant equivalent.
Solution of Design
Page 9-21
EE 422G Notes: Chapter 9 Instructor: Zhang
Comparison with impulse-invariant equivalent.
9-4B Design in the Frequency Domain --- The Bilinear z-transform
1. Motivation (problem in Time Domain Design)
Introduced by sampling, undesired!
x(t) bandlimited ( )0)2/( sffX
Page 9-22
EE 422G Notes: Chapter 9 Instructor: Zhang
for
for
Consider digital equivalent of an analogy filter Ha(f): )
Ha(f): bandlimited => can find a Hd(z) Ha(f): not bandlimited => can not find a Hd(z) Such that 2. Proposal: from axis to axis
( : given sampling frequency) (s plane to s1 plane)
Page 9-23
EE 422G Notes: Chapter 9 Instructor: Zhang
Observations: (1) Good accuracy in low frequencies (2) Poor accuracy in high frequencies (3) 100% Accuracy at a given specific number such that 0.01
Is it okay to have poor accuracy in high frequencies? Yes! Input is bandlimited! What do we mean by good, poor and 100% accuracy? Assume (1) (originally given analogy filter) (2) The transform is
Then, is a function of . Denote .
Good accuracy:
Poor Accuracy
100% Accuracy (Equal)
Is )(~
1H bandlimited? That is, can we find a 1 such that )(~1H =0?
Yes, 2/1 . We have no problem to find a digital equivalent
Page 9-24
EE 422G Notes: Chapter 9 Instructor: Zhang
without aliasing! Let’s use as a number (for example 0.2) representing any low frequency, Then, because is a good approximation of , should be a good approximation. A digital filter can thus be designed for an analogy filter which is not bandlimted!
Two Step Design Procedure: Given: analogy filter (1) Find an bandlimited analogy approximation ( ) for (2) Design a digital equivalent for the bandlimited filter . Because of the relationship between ( ) for , is also digital equivalent of . The overlapping (aliasing) problem is avoided! The designed digital filter can approximate (for and take the same value) at low frequency. 3. axis to axis (s plane to s1 plane) transformation
Requirement : ( is given sampling frequency.)
Proposed transformation :
Effect of C:We want the transformation map
(for example, ) to
=>
i.e. when the sampling period T is given, C is the only parameter which determines what will be mapped into axis with the same value.
Example:
not bandlimited
If we want to map to
Page 9-25
Variable in domain
Variable in domain
Constant
EE 422G Notes: Chapter 9 Instructor: Zhang
Hence, for any given T or
is bandlimited as a function of by
when at low frequencies.
Further Exactly holds!
How to select or sampling frequency at which ?
(1) should be small?
why? ,
(The accuracy should be good at low frequencies) (2) When is given or determined by application, should be large
enough such that to ensure the accuracy in the frequency range including
When
since for small x.
4. Design of Digital Filter using bilinear z-transform A procedure: (1)
(not bandlimited, (bandlimited,original analog) analog) or (2)
Page 9-26
EE 422G Notes: Chapter 9 Instructor: Zhang
(Transfer replace by z function of digital filter)
* Question: Can we directly obtain Hd(z) from Ha(s) ? Yes! (But how?)
Bilinear z-transform
Preparation : (1)
(2)
Hence,
Replace by s , by s1 ( )
Replace for digital filter
direct transformation from s to z (bypass s1)
Example
Digital Filter
2122212
212
21
1
21
212
2
)1()1(2)1()1(
112
)1()1(
)(
zzzCz
zz
zzC
zH
cc
c
cc
cd
C: only undetermined parameter in the digital filter.To determine C: (1)
(2) (related to the frequency range of interest)
Page 9-27
Bilinear z – transformation
EE 422G Notes: Chapter 9 Instructor: Zhang
Example 9-7
: break frequency Take Consider
C determined => Hd(z) determined
2
21
171573.01292893.0585786.0292893.0)(
z
zzzH d
, , To compare the frequency response with the original analog filter Ha : )8()2()2()(
4
ca
ff
saaa rfjHrfjHfjHjHcs
( replace s by ) ,
Too low fs => poor accuracy in fc.
Page 9-28
EE 422G Notes: Chapter 9 Instructor: Zhang
9-4C Bilinear z-Transform Bandpass Filter
1. Construction Mechanism(1)From an analog low-pass filter Ha(s)
to analog bandpass filter
i.e., replace s by to form a bandpass filter
For example low-pass
band-pass
Why? Original low-pass
Low => High Gain High => Low Gain
After Replacement
high => high => low gain
low => high => low gain
(2)From analog to digital
Replace s in by
for example
Page 9-29
In the low pass filter
EE 422G Notes: Chapter 9 Instructor: Zhang
2. Bilinear z-transform equationAnalog Low-pass Bandpass (analog)
s b
c
ss 22
)1()1()1(
11
11
2
212212
1
1
22
1
1
zCzzC
zzC
zzC
b
c
b
c
2
2122
22
22
2
212212
1
21
)1()1()1(
z
zzCC
CC
zCzzC
c
c
b
c
b
c
2
21
11
z
zBzA
with
3. How to select ( ) for bandpass filter (design)
Page 9-30
digital bandpass filter
Direct Transformation s (in low-pass)
s (in low-pass)
EE 422G Notes: Chapter 9 Instructor: Zhang
Important parameters of bandpass(1) center frequency (2) upper critical frequency(3) low critical frequency
Selection of for bandpass:
Design of ( )
We want , Also want
one parameter C => impossible
solution 2
tan2
tan22 TTC lu
c
bandwidth 2
tan2
tanT
CT
C lub
Hence, A and B can be determined to perform the transform.
4. Convenient design equation
why no C?
2tan
2tan1
2tan
2tan1
2
2tan
2tan
2tan
2tan
222
22
TT
TT
TTCC
TTCC
B
lu
lu
lu
lu
Page 9-31
EE 422G Notes: Chapter 9 Instructor: Zhang
2)cos(
2)cos(
2)cos()cos(
tantan1tantan1
T
T
lu
luyxyx
yxyx
Example : )1()1(1
11
11221
2
2
21
zzBzA
z
zzBzA
s
5. In the normalized frequencyReference frequency: sampling frequency
s
u
s
uu f
fr
s
l
s
ll f
fr
=> ,
=>
)(cos)(cos
2
)(cot
lu
lu
lu
rrrr
B
rrA
s =>
Example 9-9 Lowpass Transfer function of bandpass digital filter
A and B? Determined by design requirements. sampling frequency fs = 5000Hz
, ,
Page 9-32
In low-pass
In low-pass
EE 422G Notes: Chapter 9 Instructor: Zhang
Page 9-33
EE 422G Notes: Chapter 9 Instructor: Zhang
9-5 Design of Finite-Duration Impulse Response (FIR) Digital Filter
Direct Design of Digital Filters with no analog prototype. Can we also do this for IIR? Yes!
Using computer program in next section.9-5A A few questions1. How are the specifications given?
By given and )(
2. What is the form of FIR digital filter?Difference Equation
(What is T ? sampling period)
Transfer function 3. How to select T ?4. After T is fixed, can we define the normalized frequency r and
and )(r ? Yes!
Can we then find the desired frequency response
)()()( rjerArH ? Yes!5. Why must H( r ) be a periodic function for
digital filter? H( r ) = H ( n + r ) ? Why? What is its
period?
Page 9-34
period sampling he tnot period, )'(( 1 srHTr
r is not time
EE 422G Notes: Chapter 9 Instructor: Zhang
6. Can H( r ) be expressed in Fourier Series ? Yes! How?
See general formula :
In our case for H(r):
2/1
2/1
2
2
)(
)(
drerHX
eXrH
rjnn
n
rjnn
What does this mean? Every desired frequency response H(r) of digital filter can be expressed into Fourier Series ! Further, the coefficients of the Fourier series can be calculated using H(r)!
9-6B Design principle
n
rjnneXrH 2)(
Denote
Consider a filter with transfer function
What’s its frequency response ? )()())(( 2 2 rHenThenTh
n
rnjd
n
nrjd
given specification of digital filter’s frequency response!9-6 C Design Procedure
(1) Given H(r)
(2) Find H(r)’s Fourier series
where (3) Designed filter’s transfer function
What’s hd(nT) ? Impulse response!
Page 9-35
0 : sampling frequency? No! 0T : period of )(tx
EE 422G Notes: Chapter 9 Instructor: Zhang
Example 9-10: ) 2cos1(21)( rrH
Solution :(1) Given : done(2) Find ’s Fourier series
n
rjnd enThrrH 2)()2cos1(
21)(
where n = 0
212cos
21
21)2cos1(
21)0(
2/1
2/1
2/1
2/1
2/1
2/1
rdrdrdrrhd
2/1
2/1
)1(22/1
2/1
)1(2
2/1
2/1
2 2 22/1
2/1
2
41
41
221
21)(
dredre
dreeedrenTh
rnjrnj
nrjrjrj
rjnd
1,00)( 41
41)(
41
41)(
2/1
2/1
2/1
2/1
nnTh
drTh
drTh
d
d
d
2||,0)(,41
)(,21
)0(
41
21
41
)()( 2 2 2
nnThThh
eeenThrH
ddd
rjrj
n
rnjd
(3) Digital Filter111
41
21
41)()0()()(
zzzThhzThznTh dddn
nd
9-6 D Practical Issues : Infinite number of terms and non-causal(1)
Truncation => ))()(()()(
n
ndr
M
Mn
ndnc znThnwznThzH
Rectangular window function
MnMn
nwr ||0||1
)(
Truncation window
Effect of Truncation (windowing):Time Domain: Multiplication ( h and w )Frequency Domain: Convolution
Page 9-36
2M+1 terms
EE 422G Notes: Chapter 9 Instructor: Zhang
rrMeew
M
Mn
rnjrjr sin
)12(sin)( 2 2
(After Truncation: The desired frequency Hr
rr wH frequency response of truncated filter )The effect will be seen in examples!
(2) Causal Filters:
M
Mn
nMd
M
Mn
nd
Mc znThznThzzH )()()()(
k = n+M
Define )( MtkThL dk
Relationship: Frequency Response
MrrrrArA
eeHeHncc
nccMrjrjnc
rjc
2)()()()(
)()( 222
Design Examples
Hamming window:
Mn
MnMn
nwh
||0
||cos46.054.0)(
Example 9-11 Design a digital differentiatorStep1 : Assign
should be the frequency response of the analog differentiator H(s) = s
=> Desired rfjjrH srff
fs
2|)( 2
Step2 : Calculate hd(nT)
Page 9-37
EE 422G Notes: Chapter 9 Instructor: Zhang
njnj
fn
nf
eenj
fee
nf
enjn
fe
njnf
enj
renf
rderenf
rrdenf
drnrejnf
drerfjdrerH
drerfjdrerHnTh
ss
njnjsnjnjs
njsnjs
r
r
nrjnrjs
nrjr
r
nrjs
nrjs
nrjs
nrjs
nrj
nrjs
nrjd
sin22
cos22
22
21
21
21
21
21
)(
2
) 2()(
) 2()()(
2
2
2/1
2/1
2 2
2/1
2/1
22/1
2/1
2
2/1
2/1
2
2/1
2/1
2
2/1
2/1
22/1
2/1
2
2/1
2/1
22/1
2/1
2
i.e.,
Step 3: Construct nc filter with hamming window (M=7)
Page 9-38
nrj
b
a
b
a
b
a
evru
vduuvudv 2 ,
0
EE 422G Notes: Chapter 9 Instructor: Zhang
)()(
)()1()()1()(
7
7
1
1
7
zHzzH
znwnf
znwnf
zH
c
n
n
nh
nsn
n
nh
ns
Example 9- 12: Desired low- pass FIR digital filter
characteristic
5.0||15.00
15.0||1)(
rr
rH
nn
eenj
drenTh jjrnjd 3.0sin
1)(
21)( 3.03.015.0
15.0
2
3.01
3.0cos3.0lim) (/) (
) (/) 3.0(sinlim)0(0 0
nndnd
ndndThnnd
Page 9-39
EE 422G Notes: Chapter 9 Instructor: Zhang
NC filter with 17 weight’s window: ,
Page 9-40
EE 422G Notes: Chapter 9 Instructor: Zhang
Example 9-13 (90o phase shifter)
nnn
nee
n
en
en
drejdrjenTh
jnjn
jnjn
rnjrnjd
1
cos
1)(
21
)1( 2
1)1( 2
1
)()(2/1
0
20
2/1
2
n = 0 =>
=>
Filter: 7)()()(7
7
MznwnhzHn
nhdNC
Page 9-41
EE 422G Notes: Chapter 9 Instructor: Zhang
Fig. 9-32 Amplitude response of digital 90 degree phase shifter
9-6 Computer-Aided Design of Digital Filters
9-6A Command yulewalk for IIR
Example 9-14
9-6B Command remez for FIR
Example 9-15
Chapter 9 Homework
2, 4, 6, 11, 13, 14, 25, 26, 27, 29, 30, 31, 44, 48, 53, 61, 62, 64, 66, 68, 69
Page 9-42