You are on page 1of 36

Lecture 6 DSP 1

CC804 Digital Signal Processing


Lecture 6
z-transform
2
Lecture 6 Outline
In this lecture, well study z-transform and basic
operations using z-transform
z-transform is an important tool in the analysis
and design of digital filters
Well also look at convolution operation
Lecture 6 DSP
3
Z-transform
For a given sequence, g[n], its z-transform G(z) is defined as
where z=Real(z)+iImag(z) is a complex variable
For causal (one sided) systems (mostly encountered in DSP)
The contour is a circle in the z-plane of unity radius and is called
the unit circle
1 = z

=
n
n
z n g z G ] [ ) (

=
0
] [ ) (
n
n
z n g z G
Lecture 6 DSP
4
Rational z-transforms
Most of the time, we are concerned with rational z-transforms in
discrete-time systems
They are ratios of two polynomials
The degree of the numerator polynomial, P(z) is M and the degree of the
denominator polynomial D(z) is N
The above ratios can also be expressed as (can you get this?)
Written in factored form
(well see an example later)
Lecture 6 DSP
5
Poles and zeros
At a root , G(z)=0
These values of z are known as zeros
At a root , G(z)
These values of z are known as poles
Consider
Note that G(z) has M finite zeros and N finite poles
If N>M, there are additional N-M zeros at z=0 (the origin in the z-plane)
If N<M, there are additional N-M poles at z=0
l
z =
l
z =
Lecture 6 DSP
6
Poles and zeros an example
The z-transform
Has zero at z=0 and a pole at z=1
Lecture 6 DSP
7
Factored form of z-transform
Consider the rational z-transform
Where are the poles and zeros?
We need to convert this to factored form
We can then get the z-plane diagram
Note that complex zeros and poles always have conjugates (though, sometimes
poles/zeros can be cancelled)
But how to get it into factored form, especially for higher orders?
12 18 15 3 3
32 56 44 16 2
) (
2 3 4
2 3 4
+ +
+ + + +
=
z z z z
z z z z
z G
) 1 )( 236 . 1 1 )( 236 . 3 1 (
) 2 2 1 )( 2 1 )( 4 1 (
6667 . 0 ) (
2 1 1 1
2 1 1 1


+ +
+ + + +
=
z z z z
z z z z
z G
) ) 866 . 0 5 . 0 ( 1 )( ) 866 . 0 5 . 0 ( 1 )( 236 . 1 1 )( 236 . 3 1 (
) ) 1 ( 1 )( ) 1 ( 1 )( 2 1 )( 4 1 (
6667 . 0 ) (
1 1 1 1
1 1 1 1


+ +
+ + + + +
=
z i z i z z
z i z i z z
z G
Remember
quadratic formula
Gain
constant
Lecture 6 DSP
8
Factored form of z-transform using MATLAB
We can use the function [Z,P,K] = tf2zp(NUM,DEN)
For the eg: [Z,P,K] = tf2zp([2 16 44 56 32],[3 3 -15 18 -12])
Using zplane(Z,P) function to get the
plot
-4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0.5 1
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
Real Part
I
m
a
g
i
n
a
r
y

P
a
r
t
Lecture 6 DSP
9
We can also do the reverse using MATLAB
To determine the rational z-transform from poles and zeros, we can use
[NUM,DEN] = zp2tf(Z,P,K)
Note: Z and P must be column vectors
For example:
Zeros: 0.21, 3.14, -0.3+0.5i, -0.3-0.5i
Poles:-0.45, 0.67, 0.81+0.72i, 0.81-0.72i
Gain constant=2.2
The rational z-transform is
35411175 . 0 23004 . 0 2294 . 1 84 . 1
4932312 . 0 63592 . 1 22332 . 2 05 . 6 2 . 2
) (
2 3 4
2 3 4
+ +
+
=
z z z z
z z z z
z G
Z =[ 0.21, 3.14, -0.3+0.5i, -0.3-0.5i]
P= [-0.45, 0.67, 0.81+0.72i, 0.81-0.72i]
K=2.2
[NUM DEN]=zp2tf(Z',P',K)
Lecture 6 DSP
10
Transfer function
Consider the FIR filter:
The output from a FIR digital filter in made up of inputs x convolved
with filter coefficients h
Later, we will study convolution of input x and filter coefficients, h
In z-domain, this can be expressed as
So, convolution operation in time is now multiplication in frequency/z domain
Hence, is the transfer function of the system

=
=
M
k
k n x k h n y
0
] [ ] [ ] [

=
M
k
k
z X z k h z Y
0
) ( ] [ ) (
) ( ) ( ) ( z X z H z Y =
) ( / ) ( ) ( z X z Y z H =
Lecture 6 DSP
11
Delay property of z-transform
Before we study further on transfer function, we need to look at one
useful property of the z-transform the delay property
Example: in z domain is
How?
Plug x(n-m) into the definition of the z-transform:
Changing variables, letting k=n-m, n=k+m:
However, the system is causal, hence x(k)=0 for k<0:
Solving, we get:
) ( ) ( m n x n y = ) ( ) ( z X z z Y
m
=
n
n
z m n x z Y

=
0
) ( ) (
) (
) ( ) (
m k
m k
z k x z X
+

=
) (
0
) ( ) (
m k
k
z k x z X
+

=
k
k
m
z k x z z X

=
0
) ( ) (
) ( ) ( z X z z Y
m
=

=
0
] [ ) (
n
n
z n g z G
Lecture 6 DSP
12
Example: Moving average algorithm
Block diagram
( ) ( ) ( )
3
2 3 3 2 1
4
1
4
1
z
z z z
z X
z z z
z X z Y
+ + +
=
+ + +
=

( )
3
2 3
4
1
) (
z
z z z
z H z
X
Y + + +
= =
4
3 2 1
+ + +
=
k k k k
k
x x x x
y
Note: Each [Z
-1
] block can be thought of as a memory cell, storing the previously applied value
(We saw something similar in Lecture 3)
z-transform
Transfer function
Lecture 6 DSP
13
Another example
A causal IIR filter:
Using the delay property,
its transfer function is:
Another way of writing this:
Remember to bring the y to one side
[Z,P,K] = tf2zp([0 1 -1.2 1],[1 -1.3 1.04 -0.222])
zplane(Z,P,K)
-1 -0.5 0 0.5 1
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Real Part
I
m
a
g
i
n
a
r
y

P
a
r
t
) (
) (
) (
z X
z Y
z H =
Lecture 6 DSP
More useful z-transform properties
A few more useful z-transform properties
14 Lecture 6 DSP
Inverse z-transform
For causal sequences, we can expand rational G(z) into a
power series in z
-1
We can use the method of long division (division of the
numerator by the denominator)
Example, consider:
Which gives
And
15 Lecture 6 DSP
Inverse z-transform long division example
16 Lecture 6 DSP
Inverse z-transform using MATLAB
H = impz(NUM,DEN,N) computes N samples of the
impulse response
17
H=impz([1 2 0], [1 0.4 -0.12], 5)
Lecture 6 DSP
18
Stability analysis of transfer functions
Let us assume that we have designed the IIR filter with following H(z)
(Note: an FIR filter with bounded input is always stable, so there is no need for stability analysis)
We need to ensure that it is stable before we can use it
Consider:
-1 -0.5 0 0.5 1
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
2
Real Part
I
m
a
g
i
n
a
r
y

P
a
r
t
Since all the poles are within the unit circle,
therefore the transfer function is stable
General stability condition: If all
poles are within the unit circle, the
transfer function is stable details
next slides
a
ac b b
2
4
2

Use
) 9016 . 0 1 )( 9434 . 0 1 (
1
) (
1 1

=
z z
z H
Factored form
[Z,P,K]=tf2zp([1 0 0], [1 -1.845 0.8505686])
zplane(Z,P)
Lecture 6 DSP
19
Effects of coefficient quantisation
Now, consider the coefficients are rounded to two decimal places
Is it stable now?
-1 -0.5 0 0.5 1
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
2
Real Part
I
m
a
g
i
n
a
r
y

P
a
r
t
Since there is a pole on the unit circle, therefore the transfer
function is on the verge of instability (some may claim this as
stable, more later). This is why we must be careful when we
design filters!
[Z,P,K]=tf2zp([1 0 0], [1 -1.85 0.85])
zplane(Z,P)
Lecture 6 DSP
More on stability
The following diagrams show the locations of poles and
the stability of the transfer function
One pole (which has to be real)
20 Lecture 6 DSP
21
More on stability
The following diagrams show the locations of poles and
the stability of the transfer function
Double real poles
21 Lecture 6 DSP
22 22
More on stability
The following diagrams show the locations of poles and
the stability of the transfer function
Complex poles (conjugates)
22
Double complex poles (conjugates)
Figures from Proakis and Manolakis, Digital Signal
Processing: Principles, algorithms and applications
Lecture 6 DSP
23
Another example
Now, consider the following filter
Is it stable?
2 1
1
732 . 1 1
1
) (



=
z z
z
z H
NUM=[1 -1 0];
DEN=[1.0000 -1.7320 1.0000];
[Z P K]=tf2zp(NUM,DEN)
zplane(Z,P,K)
Lecture 6 DSP
Pole-zero cancellation
Sometimes, two unstable system can become stable through
pole-zero cancellation
However, the response could change
Example
Unstable H(z):
Multiple with G(z):
24
1
1
8 . 0 1
2 . 3 2
) (

=
z
z
z G
1
6 . 1 1
3
) (

=
z
z H
|
|
.
|

\
|

1
1
1
8 . 0 1
2 . 3 2
6 . 1 1
3
) ( ) (
z
z
z
z G z H
1
8 . 0 1
6
) ( ) (

=
z
z G z H
-1 -0.5 0 0.5 1
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Real Part
I
m
a
g
i n
a
r
y

P
a
r
t
-1 -0.5 0 0.5 1 1.5
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Real Part
I
m
a
g
i n
a
r
y

P
a
r
t
Lecture 6 DSP
Convolution
Consider an FIR filter equation:
h[k] are the filter coefficients
Also known as impulse response of the filter
Knowing the impulse response one can compute the
output of the system (in this case, the filter) for any
arbitrary input
In this scenario, we will need to convolve the impulse
response of the filter with the input data to obtain the
output data
25

=
=
M
k
k n x k h n y
0
] [ ] [ ] [
Lecture 6 DSP
Convolution Sum
The summation or
is known as convolution sum of x[n] and h[n] and is normally
represented as
Properties:
Commutative property
Associative property
Distributive property
26 Lecture 6 DSP
Convolution Sum
Interpretation of
1) time reverse h[k] to form h[-k] (folding operation)
2) Shift h[-k] by n sampling points to the right if n>0 or to the
left if n<0
3) Form the product v[k]=x[k]h[n-k]
4) Sum all samples of v[k] to develop the n-th sample of y[n] of
the convolution sum
Schematic representation
The computation of an output sample using convolution sum is
simply a sum of products
Involves fairly simple operations such as additions,
multiplications and delays
27 Lecture 6 DSP
Convolution sum (an example)
Develop the sequence y[n] generated by the convolution
of the sequences x[n] and h[n] shown below
Consider the computation of y[0]
The sequence h[-k] is
The product x[k]h[-k] is
Or compute, y[0]=x[0]h[0]=-2
28

=
=
n
k
k n h k x n y
0
] [ ] [ ] [
Lecture 6 DSP
Convolution sum (an example)
For computation of y[1], we shift h[-k] to the right by 1
The product x[k]h[1-k]
Or compute
y[1]=x[0]h[1]+x[1]h[0]=-4+0=-4
29

=
=
n
k
k n h k x n y
0
] [ ] [ ] [
Lecture 6 DSP
30
Convolution sum (an example)
For computation of y[2], we shift h[-k] to the right by 2
The product x[k]h[1-k]
Or compute
y[2]=x[0]h[2]+x[1]h[1]+x[2]h[0]
=0+0+1 = 1
30

=
=
n
k
k n h k x n y
0
] [ ] [ ] [
Lecture 6 DSP
31 31
Convolution sum (an example)
Continuing the process
y[3]=x[0]h[3]+x[1]h[2]+x[2]h[1]+x[3]h[0]
= 2+0+2-1=3
y[4]=x[0]h[4]+x[1]h[3]+x[2]h[2]+x[3]h[1]+x[4]h[0]
= 1
y[5]=x[0]h[5]+x[1]h[4]+x[2]h[3]+x[3][h2]+x[4]h[1]+x[5]h[0]
= 5
y[6]=x[0]h[6]+x[1]h[5]+x[2]h[4]+x[3]h[3]+x[4]h[2]+x[5]h[1]+x[6]h[0]
= 1
y[7]=x[0]h[7]+x[1]h[6]+x[2]h[5]+x[3]h[4]+x[4]h[3]+x[5]h[2]+x[6]h[1]
+x[7]h[0]
= -3
31

=
=
n
k
k n h k x n y
0
] [ ] [ ] [
Lecture 6 DSP
Convolution sum (an example)
From the plot of h[n-k] for n>7 and the plot of x[k] as
shown below, it can be seen that there is no overlap
between these two sequences
As a result y[n]=0 for n>7
and y[n] is
32
In general, if x[n] is length M and
h[n] is length N, then convolution
sum, y[n] is length M+N-1
Lecture 6 DSP
Tabular method of convolution sum
Consider the convolution
The samples y[n] generated by the convolution sum are
obtained by adding the entries in the column above each sample
The sum of indices inside each column will be the sample index
In MATLAB, function conv implements the convolution sum
conv([-2 0 1 -1 3], [1 2 0 -1]) returns [-2 -4 1 3 1 5 1 -3]
33 Lecture 6 DSP
Convolution cascade, parallel connection
Cascade connection
Note that the ordering of the systems in the cascade has
no effect on the overall impulse response because of the
commutative property
Parallel connection
34
Useful when we have many filter coefficients
in a system and we want to determine the
final set of filter coefficients for the system
Lecture 6 DSP
35
Convolution cascade, parallel connection
Example
Simplifying
35 Lecture 6 DSP
36
Study guide (Lecture 6)
From this weeks lecture, you should know
z-transform and its properties (especially delay)
Rational and factored forms of z-transform
Transfer functions in z-domain
Obtaining locations of pole and zero and their use in stability
analysis
Inverse z-transform
Convolution sum and its properties, computing convolution
sum (using any method equation, graphical, tabular)
As usual, MATLAB functions will not be tested in exams
End of lecture 6
Lecture 6 DSP

You might also like