z-transform
Why z-transform? The z-transform introduces polynomials and rational functions in the analysis of linear time-discrete systems and has a similar importance as the Laplace transform for continuous systems Convolution becomes a multiplication of polynomials Algebraic operations like division, multiplication and factoring correspond to composing and decomposing of LTI systems Carrying out the z-transform in general leads to functions consisting of nominator and denominator polynomials The location of the roots of these polynomial determines important properties of digital filters 2
n, ˆ, zdomain n Time domain Impulse response, difference equations, "real" signal domain ˆ Frequency domain Frequency response, spectral representation, analysis of sound z z Domain Operators, poles and zeros, mathematical analysis and synthesis 3
Input signals Impulse Complex exponential function j ˆn Ae x[n] = z n 4
z-transform and FIR- filter Using the "signal" n xn [ ] z { for all n}, zarbitrary (complex) number as input signal k yn [ ] bx[ nk] bz bzz bz k z M M M M nk n k k k k k k k k M M k on k k k k H( z) bz hk [ ] z... system functi n Remember: z j ˆ e The system function H( z) is the ztransform of the impulse response. 5
hn [ ] H( z) b, 2, H( z) bz bz bz 2z z k =+ z 2 2 2 2 2 2 z z z 2 2 z The system function is a rational function numerator polynomial z 2 2z denominator polynomial z 2 6
Impulse response: hn [ ] b[ n] b[ n] b[ n2] 2 z - Transform bz bzb System function: H( z) b bz bz z 2 2 2 2 2 7
Representation of signals A signal of finite lenght can be represented as N xn [ ] xk [ ] [ nk] k the z Transform of this signal is N k X() z xkz [] z k is an arbitrary complex number, e.g., (complex) variable of the z-transform. Alternatively we may write N k ( ) [ ]( ) X z xk z k M M k k k k H ( z) bz hk [ ] z z is the independent... System function which means, that X( z) is polynomial of order N of the variable z. 8 k
Transform The transition from n z is called z-transform of x[n]. X [z] is a polynomial in z -, the coefficients are the values of the sequence x[n]. e.g.: n n < - - 2 3 4 5 n > 5 x[n] 2 4 6 4 2 2 3 4 X( z) 24z 6z 4z 2z 9
ndomain z Domain N x[ n] xk [ ] [ nk] X ( z) xk [ ] z k k N k x[ n] X ( z) Example: xn [ ] [ nn] X[ z] z n o z jω = e DFT N j k jωk ω z = re x[ k] r e k= DFT of xkr [ ] k
The system function H( z) is a function variable z. The z Transform of a FIR-Filters is a polynom of degree M and has M zeros (fundamental theorem of algebra). of the complex Example: yn [ ] 6 xn [ ] 5 xn [ ] xn [ 2] H( z) 65 z z (3 z )(2 z ) 6 Zeros at and 3 2 z z 2 3 2 2 z
Linearity Properties of the z-transform ax [ n] bx [ n] ax ( z) bx ( z) 2 2 Time-delay z in the of in the zdomain correponds to a time delay n domain (time domain) n n < 2 3 4 5 n > 5 x[n] 3 4 5 9 X( z) 3z 4z z 5z 9z ( ) ( ) Y z z X z 2 3 4 5 = ( z ) 3z z 4z z 5z 9z 2 3 4 5 6 2
z-transform as Operator Unit-Delay Operator D yn [ ] D{ xn [ ]} xn [ ] n xn [ ] z for all n yn D xn D z z z z z xn n n n [ ] { [ ]} { } [ ] The expression z [ ] { [ ]} [ ] x[ n] is only valid for xn [ ] z Nervertheless it is common to use unit-delay operator symbol D. yn z xn xn 3 z as notation for the n!
x[n] Unit Delay x[n-] X(z) z - z - X(z) xn [ ] xn [ ] xn [ 2] xn [ 3] z - z - z - b b 2 b b 3 + + + yn [ ] 4
Convolution and z-transform ndomain zdomain yn [ ] hn [ ] xn [ ] Y( z) H( z) X( z) Cascading of systems [ ] LTI LTI 2 xn xn [ ] h[ n] 2 h[ n] h [ n] 2 ( xn [ ] h[ n]) h[ n] hn [ ] h[ n] h[ n] H( z) H( z) H ( z) 2 2 5
Example: H( z) 2z 2z z 2 3 One root of this polynomoial is at z, and we can write H z H z z H z ( ) 2( )( ) ( ) ( z ) 2 3 H( z) 2z 2z z H z z 2 H( z) z 2 z z z H( z) Partitioning 2 H ( z) z z 2 2 H z z ( ) ( ) 6
z - domain ω- ˆ domain H( z) M M k b ( ˆ k ω) k= k= = z H = be k j ˆ ωk z = e j ˆ ω... Unit circle in the complex plane 7
e.g.: H( z) 2z 2z z Poles and Zeros 2 3 j 3 j 3 ( z )( e z )( e z ) j j 3 3 2 2 ( )( )( ) 3 3 z z 3 2 z z z z z e z e ο x 3 ο ο Triple pole at zero 8
What does a zero mean? yn [] xn [] 2[ xn] 2[ xn2] xn [ 3] xn [ ] e j n 3 j j j j n n n2 n3 3 3 3 3 yn [ ] e 2e 2e e j n j j2 3 j e (2e 2 e e ) j n 3 e j 3 j 3 The complex input signals n n j 3 3 n n j n 2 3 ( z ), (z ) e, (z ) e get supressed. 9
Nulling Filter Zeros in the z plan "remove" signals of the form xn [ ] z. n To remove a cosine signal cos( ˆ n) e e both complex signals must be removed. The zeros are conjugate complex. jˆn jˆn 2 2 2
PN-Video 2
L L j2k k L ( ) ( ) H z z e z k 9 k -point running average L k H( z) z 9 22 k z z z z ( z)
3 2 2 3 z z + z 3 H( z) = 2z + 2z z = 2 2 z Imaginary Part.8.6.4.2 -.2 -.4 3 B = [ 2 2 -] A = [] zplane(b,a) -.6 -.8-6 5 Magnitude Response - -.5.5 Real Part 4 Magnitude 3 3 2 jπ /3 jπ /3 z 2z + 2z = ( z )( z e )( z e ) = z =, ± e jπ /3 23 2..2.3.4.5.6.7.8.9 Normalized Frequency ( π rad/sample)
lin log Magnitude Response Magnitude Response (db) 6 5 5 4 5 Magnitude 3 Magnitude (db) -5 2 - -5..2.3.4.5.6.7.8.9 Normalized Frequency ( π rad/sample) -2..2.3.4.5.6.7.8.9 Normalized Frequency ( π rad/sample) 24
Pole/Zero Plot Imaginary Part.8.6.4.2 -.2 -.4 H( z) =.9z -.6 -.8 - - -.5.5 Real Part PN-diagram 6 4 2 H(z) 8 6 4 Impulse response 2 Impulse Response - Amplitude.9.8.7.6.5.4.3.2. -.5.5.5 -.5 - Re Im 25 2 3 4 5 6 7 8 9 Samples
H( z) =.9z π.8.6.4 Imaginary Part.2 -.2 -.4 -.6 -.8-26 - -.5.5 Real Part
Infinite Impulse Response-Filter
First order IIR-Filter yn [ ] ayn [ ] bxn o [ ] bxn [ ] FIR block x[n] b v[n] y[n] x + + z - z - b a x x y[n-] Feed-forward block (FIR-Filter) Feed-back block 28
Example yn [ ].8 yn [ ] 5 xn [ ] ( b) xn [] 2[] n3[ n] 2[ n3] Input assumed to be zero prior to starting time n, x[n] = for n < n Output assumed to be zero before starting time of the signal y[n] = for n < n System initially at rest 29
y[].8 y[ ] 5(2).8 () 5 ( 2) y[].8 y[] 5 x[].8 () 5 ( 3) 7 y[2].8 y[] 5 x[2].8 ( 7) 5 ( ) 5.6 y[3].8 y[2] 5x[3].8 ( 5.6) 5 ( 2) 5.52 y[4].8 y[3] 5 x[4].8 (5.52) 5 ( ) 4.446 y[5].8 y[4] 5 x[5].8 (4.446) 5 ( ) 3.5328 y[6].8 y[5] 5 x[6].8 (3. 5328) 5 ( ) 2. 8262 8 6 yn [ ].8 yn [ ] 5 xn [ ] 8 6 n 3 (Input zero) yn [ ].8yn [ ] yn [ ] y[3](.8) n 3 4 4 2 2-2 -4-6 -8 5 5 Eingang -2-4 -6-8 B = [5]; A = [ -.8] filter(b,a,x) 5 5 Ausgang 3
N y[ n] ayn [ l] bx[ nk] l l M k k Output is f(output) Feed-back FIR: Output is f(input) Feed-forward M is order of filter for FIR filters, N is order of filter for IIR filters. 3
Linearity, Time-invariance IIR-Filter N y[ n] ayn [ l] bx[ nk] l l M k k are linear und time-invariant 32
Impulse response of a st order system The response to a unit pulse characterizes a LTI system completely. Input signal represented as superposition of weighted and delayed impulses, output signal constructed from weighted and delayed impulse responses: yn [] xkhn [][ k] k 33
. 2. yn [ ] ayn [ ] b xn [ ] Difference equation of impulse response hn [ ] ahn [ ] b[ n] The solution is: n bo ( a) für n h[ n] für n Proof by evaluating: h[] ah[ ] b[] ( a)() b b for n hn [ ] ahn [ ] b[ n] b( a) n a ba n ba n o o o o 34
Notation using step response [ n] for n for n hence n h[ n] b ( a ) [ n] o 35
Step response yn [ ] ayn [ ] bxn [ ] o Iterate difference equation to calculate output sequence one sample at a time: n 2 3 xn [ ] yn [ ] b b b ( a ) b b ( a ) b ( a ) b a a a 2 3 2 36
2 n yn [ ] b( aa... a) b o We recall n k a k L k= r k y[ n] r L r r L r b a n for n, if a a 37
We identify three cases: a a s and yn [ ] gets n If, than dominate larger without bound ==> unstable system n If, than decays stable system lim yn [ ] a a a to zero as n a n b a yn [ ] ( n) b output y[ n] grows as yn [ ] b if neven o yn [ ] if nodd o yn [ ] b a a n 38 n
Amplitude 2.5.5 Step Response Amplitude 5 Step Response 5 a =.5... stabil Step Response 2 a =.... instabil Step Response Amplitude.5 Amplitude 5 5 a = -... Grenzfall 5 39 a =... instabil
System function of an IIR filter ndomain zdomain yn [ ] hn [ ] xn [ ] Y( z) H( z) X( z) The system function of an FIR system is always a polynomial in z -. If the difference equation has feedback as in IIR systems, the system function is the ratio of two polynomials (rational function). 4
yn [ ] ayn [ ] bxn [ ] bxn [ ] o o Y( z) a z Y( z) b X( z) bz X( z) o Y( z) a z Y( z) b X( z) bz X( z) H( z) Yz ( ) b bz Bz ( ) o X ( z) a z A( z) Numerator polynomial: Feed-forward coefficients Denominator polynomial: + negative feed-back coefficient(s) 4
Block diagram st Direct form b bz ( ) o ( ) b bz Bz ( ) az Hz o az A z 42
Block diagram 2 nd Direct form B( z) B( z) A( z) A( z) 43
Delay elements combined 44
Poles and Zeros H( z) z z a b b o o o b bz bz b az z a Zero Pole 45
Poles and Stability The system function H( z) b b z o bz az z a b ( b ) o leads to the impulse response hn [ ] b( a) [ n] b( a ) [ n] o o n n n b n b ba a n n 46
The impulse response is proportional to a for n. The response decayes if n and a. The impulse response The location of pole(s) indicates decaying or growing impulse response. if a Systems with decaying impuls response are stable systems. grows The location of poles of stable system functions is strictly inside the unit circle of the z-plane.. n 47
Frequency response of an IIR-filter yn [ ] H( ˆ ) e H jˆ n 6 jˆ 4 ( ˆ ) He ( ) Hz ( ) jˆ ze 2 H(z) 8 6 4 2 - H( z).8 z -.5.5.5 -.5 - Re Im If sinusoidal sequence meets pole at the unit circle: bounded input unbounded output (resonance) 48
Frequency response (lin) z-domain Time-domain 49
hn [ ] H( z) H( e j ) ˆ? Poles, Zeros H(z) Time-domain Input, Output h(n) { a, b } k k Frequency domain j ˆ ( ) He 5
yn [ ] ayn [ ] ayn [ 2] bxn [ ] bxn [ ] bxn [ 2] 2 2 H( z) b bz bz 2 2 2 az az 2 Solution difference equation? He ( ) b be be ae jˆ jˆ 2 jˆ ae 2 j2ˆ jˆ 5
Inverse z-transform We consider a first order system b bz H z Y z H z X z ( ) ( ) ( ) ( ) az. Determine z transform X( z) of input xn [ ] 2. Muliply HzXz ( ) ( ) to get Y(z) 3. Determine inverse z transform of Y( z) 52
Step response of a first order system hn [ ] a [ n] n n n n H ( z) a z az n this sum is finite for H( z)... für a z az [ n] az n a az n k x k x für x Unit step for a 53
o o HzXz 2 ( a) z az Yz ( ) ( ) ( ) A az ( az ) B z or faster using residue methode Y( z) b bz bo b z A z b bz az z (determine A and B by comparing coefficients) b bz B( a z ) Y( z) ( a z ) A A A Partial fraction expansion o za z z za za bobz b ba z o a za B( a z z ) 54
( ) ( ) z a B Y z z b ba b b [ ] o yn a [ n] [ n] a a b b n A az Aa n [ n ] 55
Inverse transform (M<N). Factoring numerator polynomial of H( z) ( k ) für,2,..., 2. Partial fraction expansion H( z) k pz k N k k Ak pz 3. Inverse transform N AH z pz ( )( k ) z p N n hn [ ] Ap [ n] k k k k 56
Important transform pairs ax [ n] bx [ n] ax ( z) bx ( z) 2 2 n [ ] z ( ) xnn X z yn [ ] xn [ ] hn [ ] Y( z) X( z) H( z) [ n] [ n- n ] a n [ n] n z az 57
X( z) X( z) 2.z 2.z z z z z 2.3.4 (.5 )(.8 ) A B.5z.8z 2.z.5 z B(.5 z ) 5 ) 2 X( z)(. z A.8z.5z.8z z.5 z.5 2.z B X z z.8 z ( )(.5 ) z.8 n xn [ ] 2(.5) [ n] (.8) [ n] n 58
A = [ -.3 -.4]; B = [ -2.]; [R,P,K] = residuez(b,a) R' = - 2 P' =.8 -.5 K = [].5 Impulse Response impz(b,a) Amplitude -.5 - -.5-2 5 5 2 25 3 35 4 n (samples) 59
IIR-system second order yn [ ] ayn [ ] ayn [ 2] bxn [ ] bxn [ ] bxn [ 2] 2 o 2 Y( z) a z Y( z) a z Y( z) b X( z) bz X( z) b z X( z) 2 2 2 o 2 H( z) bo bz bz az 2 2 2 az 2 6
Poles and Zeros H( z) Y( z) b bz bz bz bzb X( z) az az z az a 2 2 2 2 2 2 2 2 A polynomial of degree N has N roots. For real coefficients of the polynomial the roots are either real or complex conjugate 6
Impulse response Y( z) b bz bz H( z) X( z) az az H( z) 2 2 2 2 b A A a pz pz 2 2 2 2 b h n n A p n A p n a 2 n n [ ] [ ] [ ] 2 2 [ ] 2 62
H( z) H( z) Real poles z z ( z )( z ) 5 2 6 6 2 3 3 2 ( z ) ( z ) 2 3 n n 2 3 hn [ ] 3 [ n] 2 [ n] For real p und p the impulse response 2 consist of two functions in the form p n k 63
B =[]; A =,-, impz(b,a) 5 6 6 Impulse Response.9.8.7 Amplitude.6.5.4.3.2. 2 4 6 8 2 n (samples) 64
Complex conjugate poles 65
Complex poles at the unit circle + z + z H( z) = = ( e z )( e z ).442z + z jπ /4 jπ /4 2 2 H( z).366e.366e = + j.78 j.78 jπ /4 jπ /4 ( e z ) ( e z ) ( π /4) j ( π /4) hn [ ] =.366 e e δ [ n] +.366 e e δ [ n] j.78 j n.78 j n π hn [ ] = 2.366 cos n.78 δ [ n] 4 66
Complex conjugate poles at unit circle Second-order oscillator 67
Complex poles inside the unit circle H( z) + z + z = = z+.5 z ( e z )( e z ) 2 jπ /4 jπ /4 2 2 j.249 j.249.58e.58e = + ( e z ) ( e z ) jπ /4 jπ /4 2 2.8 Imaginary Part.6.4.2 -.2 -.4 B = [ ]; A = [ -.5] zplane(b,a) -.6 -.8 - - -.5.5 Real Part 68
π hn [ ] = 2.58 cos n.249 2 4 Impulse Response 2 n Amplitude.5.5 H( z) + z = z +.5z 2 -.5 5 5 2 25 n (samples) 69
n n 2 2(cos ) z z sin [ ] n n 2 2(cos ) z z cos [ ] 2 2 (2rcos ) z rz n r cos n [ n] n r sin n [ n] (sin ) z (cos ) z ( rcos ) z ( rsin ) z (2rcos ) z rz 2 2 j n.5ke.5ke Kr cos( k ) [ n] n b bz Kr cos( k ) [ n] 2 2 2az r z j j j re z re z b 2 r 2 2 b 2 ab b a K 2 2 arccos arctan ab b 2 2 r a r r a 7
PZ-Video Running average FIR filter 7
Direct form I Bz () Bz () Az () Az () Direct form II 72
Transposed direct form II 73
Attention! IIR filters are often represented in the form H( z) Y( z) X( z) L bz k k M m k a z m m In such cases the coefficients a in the block diagrams are negative! 74
Filterdesign 75
SPtool Sine wave 2 khz + noise (randn) (average =, variance =.) Band pass ripple.5 db, stop band 35 db 76
77
78
No evidence of noise in filtered signal spectrum 79
Spectrum filter input Spectrum filter output 8