Lecture 04: Discrete Frequency Domain Analysis (z-transform)

John Chiverton

School of Information Technology Mae Fah Luang University

1st Semester 2009/ 2552 Outline

Overview Lecture Contents

Introduction

z-Transform Time Delays in z-Transform Representations

The Inverse z-Transform

Stability BIBO Stability Lecture Contents

Overview Lecture Contents

Introduction

z-Transform Time Delays in z-Transform Representations

The Inverse z-Transform

Stability BIBO Stability Outline

Overview Lecture Contents

Introduction

z-Transform Time Delays in z-Transform Representations

The Inverse z-Transform

Stability BIBO Stability Introduction to the z-transform

The z-transform

I Transforms a digital signal to a frequency respresentation

I Used for stability analysis using the poles and zeros

I Also used for frequency analysis Outline

Overview Lecture Contents

Introduction

z-Transform Time Delays in z-Transform Representations

The Inverse z-Transform

Stability BIBO Stability z-Transform

Two z-transforms are common in digital . The one-sided or unilateral z-transform: ∞ X X(z) = x[n]z−n n=0 and the bilateral z-transform: ∞ X X(z) = x[n]z−n. n=−∞

The one-sided transform is considered here only. z-Transform Example

Q. Find the z-Transform of a step function:

 1 for n ≥ 0 x[n] = 0 elsewhere

A.

∞ ∞ X X X(z) = x[n]z−n = z−n n=0 n=0 =(z0 + z−1 + z−2 + z−3 + z−4 + ...) „ 1 1 1 1 « = 1 + + + + + ... z z2 z3 z4

This is a geometric series of the form:

∞ X a s = ark = 1 − r k=0

where a = 1 and r = z−1 so that 1 z X(z) = = . 1 − z−1 z − 1 z-Transform Example

Q. Find the z-Transform of a square pulse:

 0.2 for 0 ≤ n < 5 x[n] = 0 elsewhere

A.

∞ 4 X X X(z) = x[n]z−n = 0.2 z−n n=0 n=0 =0.2(z0 + z−1 + z−2 + z−3 + z−4) „ 1 1 1 1 « =0.2 1 + + + + z z2 z3 z4

This is a geometric series of the form:

n−1 X 1 − rn s = ark = a 1 − r k=0

where a = 0.2, n = 5 and r = z−1 so that

1 − z−5 z5 − 1 z5 − 1 X(z) = 0.2 = 0.2 = 0.2 . 1 − z−1 z5 − z4 z4(z − 1) Time delays in z-Transform Representations

Each z−1 in a z-Transform can be considered as a single time delay. Consider the time-shifted or delayed unit impulse:

x[n] = δ[n − τ]

then the z-Transform is given by:

∞ X X(z) = δ[n − τ]zn = z−τ n=0 indicating a delay of τ samples. The z-Transform and Time Delay Example

Q. Find the signal corresponding to the z-Transform:

z X(z) = . z − 0.5

∞ P k a A. Remember the geometric series formula: s = ar = 1−r . Need to find the form k=0 of X(z) to easily find r and a... Dividing the numerator and denominator by z gives

1 X(z) = . 1 − 0.5z−1

So that r = 0.5z−1 and a = 1 then

∞ X k X(z) = `0.5z−1´ = 1 + 0.5z−1 + (0.5z−1)2 + (0.5z−1)3 + (0.5z−1)4 + ... k=0 =1 + 0.5z−1 + 0.25z−2 + 0.125z−1 + 0.0625z−4 + ...

Remembering that each z−1 is a delay of 1 time instance, the signal x[n] is then given by the coefficients for each time instance, i.e. x[0] = 1, x[1] = 0.5, x[2] = 0.25, x[3] = 0.125, x[4] = 0.0625 etc. The z-Transform and Time Delay Example 2

Q. Find the signal corresponding to the z-Transform:

z2 − 0.2 X(z) = z(z − 0.2)

n−1 P k 1−rn A. Remember the geometric series formula: s = ar = a 1−r . Need to find the k=0 form of X(z) to easily find r, a and n... Dividing through by z2 gives

1 − 0.2z−2 X(z) = . 1 − 0.2z−1

So that r = 0.2z−1, a = 1 and n = 2 resulting in:

n−1 1 X X X(z) = ark = (0.2z−1)k = 1 + 0.2z−1. k=0 k=0

Therefore the original signal, x[n] is given by x[0] = 1 and x[1] = 0.2. Outline

Overview Lecture Contents

Introduction

z-Transform Time Delays in z-Transform Representations

The Inverse z-Transform

Stability BIBO Stability The Inverse z-Transform

The inverse z-Transform Z−1(X(z)) is given by

1 Z x[n] = Z−1(X(z)) = X(z)zn−1dz 2πj

I The inverse z-Transform is not usually computed directly.

I Instead the z-Transform is split into parts using partial fractions

I And then the inverse z-Transform of the parts are found using a table of z-Transform pairs. Table of (unilateral) z-Transform Pairs

Lynn and Fuerst give the following table of z-Transform pairs:

Signal x[n] z-Transform X(z) δ[n] 1  1 for n ≥ 0 u[n] = z 0 elsewhere z−1  n for n ≥ 0 r[n] = z 0 elsewhere (z−1)2 n z a u[n] z−a n z(1−a) (1 − a )u[n] (z−a)(z−1) z(z−cos(Ω0) cos(nΩ0)u[n] 2 z −2z cos(Ω0)+1 z sin(Ω0) sin(nΩ0)u[n] 2 z −2z cos(Ω0)+1 n az sin(Ω0) a sin(nΩ0)u[n] 2 2 z −2az cos(Ω0)+a The z-Transform representation has therefore to be separated using partial fractions into parts, each of the form of the expressions on the right hand side of the above table. Method of Partial Fractions Example

Q. Decompose the following function into partial fractions:

1 . (z + 3)(z − 2)

A. Let 1 A B = + . (z + 3)(z − 2) z + 3 z − 2 Then A(z − 2) + B(z + 3) = 1. So that Az − 2A + Bz + 3B = 1

z(A + B) − 2A + 3B = 1 Therefore z(A + B) = 0 ⇒ A = −B and −2A + 3B = 1 so that −2A − 3A = 1 1 1 giving A = − 5 and B = 5 . Check:

A B − 1 1 1 (5) 1 + = 5 + 5 = 5 = z + 3 z − 2 z + 3 z − 2 (z + 3)(z + 2) (z + 3)(z + 2) Method of Partial Fractions: Cover up method Example

Q. Decompose the following function into partial fractions:

z . (z + 3)(z − 2)

z A B A. Let (z+3)(z−2) = z+3 + z−2 . To find A ⇒ z + 3 = 0 ⇒ z = −3.

˛ z ˛ −3 3 A = ˛ = = . (z + 3)(z − 2) ˛z=−3 −3 − 2 5

To find B ⇒ z − 2 = 0 ⇒ z = 2. ˛ z ˛ 2 2 B = ˛ = = . (z + 3)(z − 2) ˛z=2 2 + 3 5

Hence z 3 2 = 5 + 5 . (z + 3)(z − 2) z + 3 z − 2 Check:

3 2 3 (z − 2) + 2 (z + 3) 3 z − 6 + 2 z + 6 z 5 + 5 = 5 5 = 5 5 5 5 = . z + 3 z − 2 (z + 3)(z − 2) (z + 3)(z − 2) (z + 3)(z − 2) Inverse z-Transform Example

Q. Find the inverse z-Transform of:

1 1 „ 1 1 « X(z) = = − . (1) (z + 3)(z − 2) 5 z − 2 z + 3

A. Re-writing (1) to z−1 „ z z « X(z) = − . (2) 5 z − 2 z + 3 Enables us to find inverse z-Transforms for the two terms inside the brackets:

„ z « Z−1 = 2nu[n] z − 2

and „ z « Z−1 − = −((−3)n)u[n]. z + 3 The two terms are multiplied by z−1 which is equivalent to a time delay hence the final signal is given by:

1 “ ” x[n] = Z−1(X(z)) = 2(n−1)u[n − 1] − ((−3)(n−1))u[n − 1] . 5 Inverse z-Transform Example

Q. Find the inverse z-Transform of:

z X(z) = . (z + 3)(z − 2)

3 2 z 5 5 A. From earlier the partial fraction expansion is given by: (z+3)(z−2) = z+3 + z−2 . (i) However it is more convenient if we divide both sides by z first. Hence (ii) We saw earlier: „ « X(z) 1 −1 z n = . Z = 2 u[n] z (z + 3)(z − 2) z − 2 and The Right Hand Side (RHS) has partial fractions (see earlier slide): „ z « Z−1 − = −((−3)n)u[n] z + 3 X(z) − 1 1 = 5 + 5 . z z + 3 z − 2 so that

Multiplying both sides by z then gives: x[n] =Z−1(X(z)) “ ” 1 „ −z z « 1 (n) (n) X(z) = + . = 2 u[n] − ((−3) )u[n] . 5 z + 3 z − 2 5 Inverse z-Transform: Algebraic Long Division

The numerator and the denominator of the z-Transform can be divided using algebraic long division to find coefficients that correspond to the original signal. Example Q. Given H(z) = z = z , determine the coefficients. (z−1)(z+2) z2+z−2

A. Via algebraic or polynomial long So the coefficients of the original signal division: are given by: x[0] = 0, x[1] = 1, x[2] = −1, x[3] = 3, z−1 − z−2 + 3z−3 − 5z−4... x[4] = −5, etc. 2 This can be checked by performing the z + z − 2dz inverse z-Transform on H(z). z + 1 − 2z−1 Expansion with partial fractions gives: 1 “ z z ” −1 H(z) = − − 1 + 2z 3 z−1 z+2 −1 −2 Inverse z-Transform: x[n] = −1 − z + 2z −1 1 n Z (H(z)) = 3 (u[n] − (−2) u[n]) 3z−1 − 2z−2 1 Then x[0] = 3 (1 − 1) = 0, −1 −2 −3 1 3z + 3z − 5z x[1] = 3 (1 + 2) = 1, x[2] = 1 (1 − 4) = −1, − 5z−2 + 5z−3 3 1 x[3] = 3 (1 + 8) = 3, ... 1 x[4] = 3 (1 − 15) = −5, etc. This confirms the long division result. Inverse z-Transform Example

Q. Find the inverse z-Transform of:

0.5z X(z) = (3) z2 − z + 0.5

A. The table of z-Transform pairs has the following definition:

„ az sin(Ω ) « Z−1 0 = an sin(nΩ )u[n]. (4) 2 2 0 (z − 2az cos(Ω0) + a )

Therefore we can try to equate the terms inside (4) and (3).

2 In the numerator: a sin(Ω0) = 0.5, and in the denominator a = 0.5 √ √ √ −1 π ⇒ a = 0.5, then sin(Ω0) = 0.5/ 0.5, ⇒ Ω0 = sin (0.5/ 0.5) = . 4 We can therefore plug these values into the result of (4) to find the inverse z-Transform of (3):

„ 0.5z « √ x[n] = Z−1 = ( 0.5)n sin(nπ/4)u[n]. z2 − z + 0.5 Outline

Overview Lecture Contents

Introduction

z-Transform Time Delays in z-Transform Representations

The Inverse z-Transform

Stability BIBO Stability BIBO Stability

I A is said to be stable if it has:

I A Bounded Output for A Bounded Input

I Bounded means the signal does not exceed a particular value. I System stability is expressed using a function of the h[n] of the system: ∞ X |h[n]| < ∞ (5) −∞ where |h[n]| is the absolute value of h[n]. i.e. | − h[n]| = |h[n]|.

I Equation (5) states that the sum across all values of the impulse function should be smaller than infinity (∞).

I This ensures that the system is bounded and will not be larger than infinity for some input

I If equation (5) is true then the system can be described as being BIBO stable.

I A system is not usually very useful if it goes to ±infinity. z-Transform and Stability

I The z-Transform can be used to determine if a system is stable. I The z-Transform results in a consisting of a numerator N(z) and a denominator D(z)

N(z) X(z) = D(z)

I X(z) can be

I A system input I A system output I A system transfer function

I The stability of X(z) can be found by the roots of N(z) and D(z): N(z) K(z − z )(z − z )(z − z )... X(z) = = 1 2 3 D(z) (z − p1)(z − p2)(z − p3)... z-Transform and Stability

N(z) K(z − z )(z − z )(z − z )... X(z) = = 1 2 3 D(z) (z − p1)(z − p2)(z − p3)...

I The roots of the numerator are z1, z2, z3... known as zeros I The roots of the denominator are p1, p2, p3... known as poles I The zeros are values of z that make X(z) → 0 I e.g. if z = z1 then

N(z = z1) K(z1 − z1)(z1 − z2)(z1 − z3)... X(z = z1) = = D(z = z1) (z1 − p1)(z1 − p2)(z1 − p3)... K × 0 × (z − z )(z − z )... = 1 2 1 3 = 0 (z1 − p1)(z1 − p2)(z1 − p3)...

I The poles are values of z that make X(z) → ∞ I e.g. if z = p1 then

N1 K(p1 − z1)(p1 − z2)(p1 − z3)... X(z = p1) = = D1 (p1 − p1)(p1 − p2)(p1 − p3)... K(p − z )(p − z )(p − z )... K... = 1 1 1 2 1 3 = = ∞ 0 × (p1 − p2)(p1 − p3)... 0 z-Transform and Stability: z-Plane

A z-Transform can be represented graphically with the z-Plane.

I The z-Plane is complex√ (a + jb) where j = −1 I The vertical axis (↑) is imaginary (b) I The horizontal axis (→) is real (a) I The z-Plane is also known as an Argand diagram z-Transform and Stability: z-Plane

N(z) K(z − z )(z − z )(z − z )... X(z) = = 1 2 3 D(z) (z − p1)(z − p2)(z − p3)...

I Each zero: z1, z2, z3, ... is represented by a circle: O

I Each pole: p1, p2, p3, ... is represented by a cross: X z−1 I e.g. X(z) = (z+0.5)(z−0.4) then

I z1 = 1 + 0j I p1 = −0.5 + 0j I p2 = 0.4 + 0j z-Transform and Stability: z-Plane

Stability is determined by the location of the poles in the z-plane. Example

Y (z) 1 H(z) = = X(z) (z − a)

I From the table of z-Transform pairs: −1  z  n I Z z−a = a u[n] −1  z  I ∴ let H(z) = z z−a −1 I z is a unit delay hence: n−1 I x[n] = a u[n − 1] 2 3 I So that x[0] = 0, x[1] = 1, x[2] = a, x[3] = a , x[4] = a etc. z-Transform and Stability: z-Plane

n−1 I x[n] = a u[n − 1] 2 3 I x[0] = 0, x[1] = 1, x[2] = a, x[3] = a , x[4] = a etc.

I If a = 0.99

I Decreasing and tending to zero (x[n] → 0) when a < 1 z-Transform and Stability: z-Plane

n−1 I x[n] = a u[n − 1] 2 3 I x[0] = 0, x[1] = 1, x[2] = a, x[3] = a , x[4] = a etc.

I If a = 1.01

I Increasing and tending to infinity (x[n] → ∞) when a > 1 z-Transform and Stability: z-Plane

x[n] = an−1u[n − 1] I Decreasing and tending to zero (x[n] → 0) when a < 1 I Increasing and tending to infinity (x[n] → ∞) when a > 1 These observations are true more generally: N(z) K(z − z )(z − z )(z − z )... X(z) = = 1 2 3 D(z) (z − p1)(z − p2)(z − p3)...

If the magnitude of any pole (pi) is greater than 1 then the system will tend to infinity.

I A unit circle is drawn on the z-plane. I If any pole is outside of the unit circle then the system is not stable. z-Plane and Stability: Magnitude Example

If the magnitude of any pole (pi) is greater than 1 then the system will tend to infinity. Q. Determine whether the following system is stable:

1 H(z) = (z − 0.7 + 0.8j)(z − 0.7 − 0.8j)

A. The system has two poles at:

p1 = 0.7 − 0.8j and p2 = 0.7 + 0.8j.

The distance from the origin of these poles is given by the magnitude:

p r = 0.72 + 0.82 = 1.063 > 1.

These poles are beyond the unit circle, therefore this system is not stable. z-Plane and Stability: Magnitude Example

Q. Determine whether the following system is stable:

1 H(z) = (z − 0.5 − 0.5j)(z − 0.5 + 0.5j)

A. The system has two poles at:

p1 = 0.5 + 0.5j and p2 = 0.5 − 0.5j

The distance from the origin of these poles is given by the magnitude:

p r = 0.52 + 0.52 = 0.707 < 1.

These poles are inside the unit circle, therefore this system is stable. z-Plane and The Zeros

The z-Plane zeros:

I Do not determine stability:

I They can be located anywhere in the z-Plane without directly affecting stability

I If a zero is located at the origin then there is a time advance of a signal

I If there are more zeros than poles then the system starts before n = 0 and is therefore not causal

I It is usually desirable to have the same number of poles and zeros in a system to:

I Ensure minimum delay or time lag I Ensure the system is causal z-Plane and The Zeros Example

The inverse z-Transform of: 1  z  H(z) = = z−1 z − 0.4 z − 0.4

is given by (using the table of z-Transform pairs):

x[n] = 0.4n−1u[n − 1],

which has a delay of 1 time interval. If we provide H(z) with a zero at the origin (i.e. z1 = 0) so that: z − z z H(z) = 1 = z − 0.4 z − 0.4 then the inverse z-Transform is given by:

x[n] = 0.4nu[n],

which has no time delay. Lecture Summary

Today’s lecture has covered:

I The z-Transform

I The inverse z-Transform

I Stability analysis using the z-plane

I Partial fractions

I The z-Transform and time delays