Biosignals & Biosystems: Block 2. The Z-Transform
Biosignals & Biosystems: Block 2. The Z-Transform
Biosignals & Biosystems: Block 2. The Z-Transform
Gemma Piella
Departament de Tecnologies de la Informació i les Comunicacions
Universitat Pompeu Fabra, Barcelona, Spain
gemma.piella@upf.edu
Review TSiS
Decomposition of the signal into its freq. (sinusoidal) components: Fourier analysis
Recombination of the freq. components to reconstruct the signal: Fourier synthesis
Review TSiS
Fourier transforms
3
Signal representation domains
discrete-time domain
x (n )
X (z ) X ( )
j
z domain
z=e frequency domain
z-transform
X ( z) = x (
n = −
n ) z −n
z C
z-plane
x(n) X ( z )
z = re j
x(n) = x(k ) (n − k )
k = −
X ( z) = x (
k = −
k ) z −k
time-domain z-domain
Determine the z-transform of
➢ x ( n ) = 2 ( n ) − ( n − 1)
➢ x ( n ) = 1,2,1,0,2
➢ x ( n ) = 1,2,1,0,2
−1 −3 −5
➢ X ( z ) = 1 − 2 z + 3 z − z
Region of convergence
x(n) = x(k ) (n − k )
k = −
X ( z) = x (
k = −
k ) z −k
power series
Example:
x(n) = (n − k ) X ( z) = z −k
a u (n) z = ( az −1 ) n =
−n 1
X ( z) = n
for z a
n = − n =0 1 − az −1
− a u (− n − 1) z −n −1 m
X ( z) = n −1 n
n = − n = − m =1
1
= for z a
1 − az −1
Region of convergence
• For infinite-duration
– Causal signal: the ROC is the exterior of a circle
– Anticausal signal: the ROC is the interior of a circle
– Two-sided signal: the ROC is a ring (if it exists)
Region of convergence
• Convergence criterium:
n = −
x(n) z − n
−1
n = −
x(n) z −n
=
n = −
x(n) z −n
=
n = −
x(n) z −n
+ x(n) z − n
n =0
converges if z r1 converges if z r2
ROC: r2 z r1
x(n) X ( z ) n = −
• Linearity
a1 x1 ( n ) + a 2 x2 ( n ) a1 X 1 ( z ) + a2 X 2 ( z )
• Time-shifting
x(n − m) X ( z ) z − m
• Scaling
a n x ( n ) X ( a −1 z )
• Convolution
x1 ( n ) * x2 ( n ) X 1 ( z ) X 2 ( z )
• Time-reversal
x ( − n ) X ( z −1 )
• Express the z-transform of the cross-correlation between
real signals x1(n) and x2(n), as a function of X1(z) and X2(z)
elsewhere
−1
B ( z ) b0 + b1 z + + bM z −M
N −M
(z − z k ) (1 − z k z −1 )
X ( z) = = = Gz k =1
=G k =1
A( z ) a0 + a1 z −1 + + a N z − N N N
( z − pk ) (1 − p k z −1
)
– Zeros: values of z’s such that X(z)=0 k =1 k =1
Example:
1
x(n) = a nu (n) X ( z ) = for z a
1 − az −1
• Example:
2 + 2 z −1
X ( z) =
1 − z −1 + z − 2
z1 = 0, z 2 = −1
p1 = e j / 3 , p 2 = e − j / 3
Poles and Zeros
Example:
x ( n ) = a n , 0 n N − 1 where a0
N −1 N −1
1 − ( az −1 ) N 1 zN − aN
X ( z) = a z n −n
= (az ) = −1 n
−1
= N −1
n =0 n =0 1 − az z z−a
N = 20 Im
• Zeros of X(z): roots of the numerator
𝑧 𝑁 = 𝑎𝑁
N-1 zeros z =a
𝑧 𝑁 𝑒 𝑗𝜃𝑁 = 𝑎𝑁 ⇒ 𝑧 = 𝑎 𝑎𝑛𝑑 𝑒 𝑗𝜃𝑁 = 1
2𝜋𝑘
𝑗
⇒ 𝑧 = 𝑎𝑒 𝑁 𝑘 = 0, … , 𝑁 − 1
N-1 poles 2𝜋 4𝜋 2𝜋(𝑁−1)
𝑗 𝑗 𝑗
Re 𝑧 = 𝑎, 𝑎𝑒 𝑁 , 𝑎𝑒 𝑁 , … , 𝑎𝑒 𝑁
• Formal method:
– Using a contour integral over a closed path C that encloses the origin and
lies within the ROC
• Practical methods:
– Identification (= table look up)
– Expansion into a series of terms (as function of z and z-1)
– Partial fraction expansion
Inverse z-transform by identification
1
Recall that ROC : z a is the z-transform of x(n)= -an u(-n-1)
1 − az −1
Inverse z-transform by power series expansion
5 1
𝑥 𝑛 =𝛿 𝑛+2 + 𝛿 𝑛+1 + 𝛿 𝑛 −𝛿 𝑛−1
2 2
Inverse z-transform by partial fraction expansion
−1 −M −1 −M
B ( z ) b0 + b1 z + + bM z b0 + b1 z + + bM z
X ( z) = = =
A( z ) a0 + a1 z −1 + + a N z − N a0 (1 − p1 z −1 )...(1 − p N z −1 )
( )
N
Ai
X ( z) = −1
Ai = 1 − pi z −1 X ( z ) z = p
i =1 1 − p i z i
Remainder of B(z)/A(z)
– If M≥N inverse z-transform
M −N N
B' ( z) Ai
X ( z) = Q( z) +
A( z )
=
i =0
Bi z +
−i
i =1 1 − p z −1
i
Quotient of B(z)/A(z)
(
Ai = 1 − pi z −1
) B' ( z)
Bi ( n − i )
A( z ) z = pi
1 − 2 . 1z − 1
• Determine the inverse of X ( z ) =
1 − 0.3 z −1 − 0.4 z − 2
Relation to the Fourier transform
X ( ) = x ( n )e
n = −
− j n
X ( z) = x (
n = −
n ) z −n
LTI systems
x(n) y(n)
h(n)
= h ( k )e − j k
Ae jn • Ae jn is an autofunction of the LTI system
k = −
and H ( ) its eigenvalue
input
H ( ) • H ( ) is the DTFT of h(n)
Frequency
response
LTI systems
x(n) y(n)
h(n)
y (n) = x(n) * h(n) = x(k )h(n − k ) = h(k ) x(n − k )
k = − k = −
= h(k ) z
k = −
n−k
• zn is an eigenfunction of the LTI system
and H(z) is its eigenvalue
= h(k ) z
k = −
−k
zn • H(z) is the z-transform of the impulse
response h(n)
input
H (z )
System function (or transfer function)
LTI systems
x(n) y(n)
LTI
δ(n) h(n)
Ae jn Ae jn H ( )
zn z n H (z )
• Relation between frequency response and system function:
H ( ) = H ( z ) z = e j 𝑖𝑓 𝑧 = 1 ∈ 𝑅𝑂𝐶 of 𝐻(𝑧)
Exercise:
−1 −2 −3
Given a system with H ( z ) = 1 − 2 z + 2 z − z
• determine its frequency response
• determine the output when the input is x ( n ) = 1 + e − jn / 3 + e jn / 4
Review TSiS
Frequency response
x(n) y(n)
LTI
y ( n ) = IDTFT { X ( ) H ( )}
•
N M
Using a difference equation: y ( n ) = − a k y ( n − k ) + bk x ( n − k )
k =1 k =0
N M
Y ( )(1 + a k e − j k
) = ( bk e − jk ) X ( )
k =1 k =0
Y ( ) b e k
− j k
H ( ) = = k =0
X ( ) N
1 + a k e − j k
k =1
System function
h(n)
x(n) y(n)
LTI
X (z ) H (z ) Y (z )
Y ( z) k
b z −k
But we need to specify the ROC
H ( z) = = k =0
N to completely characterize the LTI
X ( z)
1 + ak z − k system
k =1
Review TSiS
LTI systems
•
M M
For a FIR system: y ( n ) = b k x ( n − k ) → h(n) = b k (n − k )
k =0 k =0
M
H ( z ) = bk z − k Polynomial
k =0
N M
k
b z −k
H ( z) = k =0
N Rational function
1 + ak z − k
k =1
Poles and Zeros of H(z)
ς𝑀 −1
𝑘=1(1 − 𝑧𝑘 𝑧 ) Im
𝐻(𝑧) = 𝐴 𝑁
ς𝑘=1(1 − 𝑝𝑘 𝑧 −1 )
p1
e j 0
Example:
Z1 (2 zeros)
Re
(𝑧 − 𝑧1 )2
𝐻(𝑧) =
(𝑧 − 𝑝1 )(𝑧 − 𝑝2 ) p2
(𝑒 𝑗𝜔0 − 𝑧 )2
1
𝐻(𝑒 𝑗𝜔0 ) = 𝑗𝜔
(𝑒 0 − 𝑝1 )(𝑒 𝑗𝜔0 − 𝑝2 ) Pole-zero plot for z1=0 (double) and p1=p2*=0.8 ej𝜋/4
Poles and Zeros of H(z)
Examples:
– y(n)=0.5y(n-1)+2x(n)
2 2z
H ( z) = = one zero at z=0 and one pole at z=0.5
1 − 0.5 z −1 z − 0.5
– y(n)= 0.5y(n-1)+3x(n-1)
3 z −1 3
H ( z) = = one zero at z=∞ and one pole at z=0.5
1 − 0.5 z −1 z − 0.5
– y(n)=x(n)-2x(n-1)+2x(n-2)-x(n-3)
j / 3 − j / 3
−1 −2 −3 z 3 − 2 z 2 + 2 z − 1 ( z − 1)( z − e )( z − e )
H ( z) = 1 − 2z + 2z −z = =
z3 z3
Zeros: z1=1, z2=ejπ/3= z*3
Poles: three at z=0
Zeros of H(z) on the unit circle
Example:
H ( z ) = 1 − 2 z −1 + 2 z −2 − z −3
z =1
z = e j / 3
z = e − j / 3
The zeros that lie on the unit circle correspond to frequencies at which the
gain of the system is zero (i.e., the frequency response is zero for
those frequencies)
Zeros of a FIR linear phase filter
ℎ(𝑛) = ±ℎ(𝑀 − 𝑛)
Example:
Review TSiS
• An LTI system is causal iff the ROC of the system function is the
exterior of a circle of radius r<∞ , including z= ∞
• An LTI system is stable iff the ROC of the system function includes
the unit circle
• A causal LTI system is stable iff all poles are inside the unit circle
Causality and stability in LTI systems
Causal systems: ROC extends outward Stable systems: ROC includes the unit circle
from the outermost pole
Im Im
Re Re
ROC ROC
Causality and stability in LTI systems
1
H ( z) = for z a Im
1 − az −1
h( n) = a n u ( n) 1
Re
a
Not stable for |a|≥1
Causality and stability in LTI systems
h(n) = a n , 0 n N −1
N −1 N −1
1 − ( az −1 ) N 1 zN − aN
H ( z ) = a n z − n = ( a z −1 ) n = = N −1
n =0 n =0 1 − az −1 z z−a
Zero z=0 cancels
Im the pole at z=a
N-1 zeros
ROC: |z|>0
ROC does not include any pole
N-1 poles
Re
Causal and stable
Example: moving average filter
Moving average filter
𝐿−1 𝐿−1
1 1
𝑦(𝑛) = 𝑥(𝑛 − 𝑘) ℎ(𝑛) = 𝛿(𝑛 − 𝑘)
𝐿 𝐿
𝑘=0 𝑘=0
𝐿−1 −𝐿 𝐿−1
1 1 1 − 𝑧 1 𝑧 ROC: |z|>0
𝐻(𝑧) = 𝑧 −𝑘 = ⋅ = ⋅
𝐿 𝐿 1 − 𝑧 −1 𝐿 𝑧 𝐿−1 (𝑧 − 1)
𝑘=0
𝐿−1 𝜔
1 1 1 − 𝑒 −𝑗𝜔𝐿
1 sin 2 𝐿 −𝑗𝜔(𝐿−1)
𝐻(𝜔) = 𝑒 −𝑗𝜔𝑘 = ⋅ −𝑗𝜔
= ⋅ 𝜔 𝑒 2
𝐿 𝐿 1−𝑒 𝐿 sin
𝑘=0 2
For L=11: H ( )
1 z L −1
H ( z ) = L −1
L z ( z − 1)
• Zeros of H(z): roots of the numerator
2 k
j
L=11
zL =1 z = e L
k = 0, , L − 1
2 4 2 ( L −1)
j j j
z = 1, e L
,e L
, , e L
z = 0 (order L − 1)
z =1
Review TSiS
addition
delay
multiplier
N M
Direct form to implement a system defined by a difference equation: y ( n ) = − ak y ( n − k ) + bk x ( n − k )
k =1 k =0
Block diagram representation of a difference equation
• All the unit delays become z-1 operators in the z-transform domain
_ y(n)
x(n)
x(n) y(n)
0.9
Review TSiS
X ( ) Y ( )
H 1 ( ) H 2 ( )
X ( ) Y ( )
H 1 ( ) H 2 ( )
h ( n ) = IDTFT {H 1 ( ) H 2 ( )}
y ( n ) = IDTFT { X ( ) H 1 ( ) H 2 ( )}
Cascaded LTI systems
H ( ) = H ( z ) z = e j
X (z ) Y (z )
H1 ( z) H 2 ( z)
X (z ) Y (z )
H1 ( z) H 2 ( z)
h ( n ) = ITZ {H 1 ( z ) H 2 ( z )}
y ( n ) = ITZ { X ( z ) H 1 ( z ) H 2 ( z )}
LTI systems - relationship among the n, z and ω domain
discrete-time domain
h (n ) Impulse response
System function H (z )
j
H ( ) Frequency response
(or transfer function)
z domain z=e frequency domain
Review
LTI systems - relationship among the n, z and ω domain
Review
Some transforms and properties
Review
Some properties
Preparing seminar 1
• BEFORE seminar 1:
– Read/study the lectures notes (both block 1 & 2) and complement them
with bibliography (chapter 3 of book of reference). Key ideas.
– Exercises 1, 2 and 3 of SEMINAR 1
– First four exercises of QUIZZES
– Solve whatever doubt that may arise
– Write the difference equation that relates the output of the system to the
input x(n)
– Determine the impulse response
Solution:
1.
𝑌 𝑧 = −𝑋1 𝑧 +2𝑋2 𝑧 𝑧 −1 = −(3 + 2𝑧 −1 )+2·(1 − 𝑧 −2 ) 𝑧 −1 = - 3 - 2 𝑧 −3
2. 𝑦 𝑛 = 𝑥 𝑛 + 5𝑥 𝑛 − 1 − 3𝑥 𝑛 − 2 + 2.5𝑥 𝑛 − 3 + 4𝑥 𝑛 − 8
ℎ 𝑛 = 𝛿 𝑛 + 5𝛿 𝑛 − 1 − 3𝛿 𝑛 − 2 + 2.5𝛿 𝑛 − 3 + 4𝛿 𝑛 − 8
• Compute the convolution of the signals
1 0 n 5
x1 ( n ) = 1,−2,1 x2 ( n ) =
0 elsewhere
in two different ways:
Solution: x1 ( n ) * x2 ( n ) = 1,−1,0,0,0,0,−1,1
• Determine the z-transform and ROC of
➢ x ( n ) = 2 n u ( n ) + 3n u ( − n − 1)
➢ x ( n ) = 3n u ( n ) + 2 n u ( − n − 1)
Solution:
1 1
For the first signal: 𝑋 𝑧 = − 𝑅𝑂𝐶: 2 < 𝑧 < 3
1 − 2𝑧 −1 1 − 3𝑧 −1
➢ x ( n ) = (cos 0 n )u ( n )
➢ x ( n ) = (sin 0 n )u ( n )
➢ X ( z) = 1 1 1 1 1 − z −1
cos 0
+ = ROC : z 1
2 1 − e j0 z −1 2 1 − e − j0 z −1 1 − 2 z −1 cos 0 + z − 2
➢ X ( z) = z −1
sin 0
ROC : z 1
1 − 2 z −1 cos 0 + z − 2
• Determine the z-transform and ROC of
➢ x ( n ) = a n (cos 0 n )u ( n )
➢ x ( n ) = a (sin 0 n )u ( n )
n
Hint: use results from previous slide and the scaling property
1 − az −1 cos 0
➢ X ( z) = ROC : z a
1 − 2 az −1 cos 0 + a 2 z − 2
az −1 sin 0
➢ X ( z) = ROC : z a
1 − 2 az −1 cos 0 + a 2 z − 2
• Consider the LTI system
y ( n ) = 2 y ( n − 1) − y ( n − 2) + x ( n ) + x ( n − 1)
Solution:
1 + z −1
H ( z) =
1 − 2 z −1 + z − 2
3
h ( n ) = 2.62 cos( n − )u ( n )
4 8
(see next slide for resolution of last question)
From H(z), we use partial fraction expansion to obtain h(n):
• Compute the inverse z-transform of
3 + z −1 + z −2
X ( z) =
1 − 2.5 z −1 + z − 2
59
Solution:
x ( n ) = ( n ) + 5 2 n u ( n ) − 3 0 .5 n u ( n ) ROC : z 2
This can be deduced by thinking how poles and zeros affect the frequency
response.
A pole will push up the frequency response, and a zero will pull it down.
Furthermore, a zero on the unit circle will force the frequency response to be
zero at the frequency corresponding to the angular position of the zero
• Consider the system:
– Determine the difference equation of the system and its impulse response
– Determine the system function and the frequency response
– When ω0 = π/2, determine the output y(n) to the input:
𝜋 𝜋
𝑥(𝑛) = 3 cos( 𝑛 + )
3 6
Solution:
• Output: 𝜋 𝜋 𝜋 𝜋 𝜋 𝜋
𝑦 𝑛 = 3 |H |cos( 3 𝑛 + 6 + 3 ) = 3cos( 3 𝑛 + 2 )
3
• Which of the following system functions correspond to a causal
system?
• Only the middle one is causal. For the right one: , which has a
pole at z=∞
•
• Consider two causal systems with pole-zero diagrams depicted
below. For each, write the corresponding transfer function, the
ROC, and justify whether it is stable.
2𝜋/7
𝜋/6
67
Solutions
• Causal systems
𝐺 1−𝑧 −7
– For system 1 (similar diagram than in slide 15 & 38): 𝐻 𝑧 = 1−𝑧 −1
.
ROC: |z|>0. Stable.
1
– For system 2: 𝐻 𝑧 = 𝐺 𝑗𝜋 𝑗𝜋 . ROC: |z|>1 Not stable.
−
1−𝑒 6 𝑧 −1 1−𝑒 6 𝑧 −1
68
Thanks for your
attention!