You are on page 1of 31

Basics on Digital Signal Processing

z - transform - Digital Filters

Vassilis Anastassopoulos
Electronics Laboratory, Physics Department,
University of Patras

Outline of the Lecture


1. The z-transform
2. Properties
3. Examples
4. Digital filters
5. Design of IIR and FIR filters
6. Linear phase

2/31

z-Transform
N 1

X (k ) x(n) e

2
nk
N

n 0

Time to frequency

N 1

X ( z ) x(n) z n
n 0

Time to z-domain (complex)

Transformation tool is the


complex wave

Transformation tool is

e j e j 2k / N

With amplitude
changing(?) with time

With amplitude |ej|=1

z e j e j

The z-transform is more general than the DFT


3/31

z-Transform
For z=ej i.e. =1 we work on the
unit circle

And the z-transform degenerates


into the Fourier transform.
I

-z

N 1

X ( z ) x(n) z n
n 0

z=R+jI

|z|=1

The DFT is an expression of the z-transform on the unit circle.

The quantity X(z) must exist with finite value on the unit circle i.e. must
posses spectrum with which we can describe a signal or a system.
4/31

z-Transform convergence
We are interested in those values of z for which X(z) converges.
This region should contain the unit circle.

Why is it so?

|a|

N 1

N 1

n 0

n 0

X ( z ) x(n) z n x(n) (1/z n )


R

At z=0, X(z) diverges

ROC

The values of z for which X(z) diverges are


called poles of X(z).

5/31

z-Transform example
Which is the z-transform and the ROC of a discrete time sequence
x(n)=an for n0 and a<1 ?

x(n)

|a|
2

a3

a4

R
ROC

n
N 1

X ( z ) x(n) z
n 0

a z
n 0

n n

(az 1 )n
n 0

which for |az-1|<1 or |z|>|a| converges to

X ( z)

The pole z=a, is never included in the ROC

1
1 az 1

za
6/31

Poles and zeros of X(z)


I

Poles: X(z)=

Zeros: X(z)=0

For infinite sequences, X(z) converges


everywhere outside the circle with radius the
pole with maximum value.

|a|
R
ROC

For finite sequences, X(z) converges


everywhere except at z=0
x(n)

5
3
1

X ( z )

x( n)z n z 1 3z 2 5z 3 3z 4 z 5

For stable, causal digital systems the region of convergence includes the
Unit Circle so that the system possesses spectrum

7/31

z-Transform general form


a0 a1z 1 a2 z 2 aN z N
X ( z)
b0 b1z 1 b2 z 2 bN z M

X ( z)

k ( z z1 )( z z2 )( z z N )
( z p1 )( z p2 ) ( z pN )

Those values of z (zi) that make the nominator zero are called zeros.
While the poles are the values of z (pi) that make the denominator zero
and thus X(z) diverges.

For stable, causal digital systems the region of convergence includes the
Unit Circle so that the system possesses spectrum

H (e

jT

) H ( z ) z e jT

h( n)z

z e jT

h( n)e jT

8/31

Inverse z-Transform
A simple way to evaluate the signal from the X(z) is to perform the
division

1 2 z 1 z 2
X(z)
1 z 1 0.356 z 2

X ( z ) 1 3z 1 36439
.
z 2 2.5756 z 3
The signal is x(0)=1, x(1)=3, x(2)=3.6439, x(3)=2.5756

9/31

z-Transform properties

Linearity

Delay or Shift

Convolution

x1 ( n ) X1 ( z )
x2 ( n) X 2 ( z )
ax1 ( n ) bx 2 ( n ) aX1 ( z ) bX 2 ( z )
x(n) X ( z )
x ( n m) z m X ( z )

y( n )

h( k )x( n k )

Y( z ) H( z ) X ( z )

10/31

z-Transform and digital systems


N

k 0

k 1

y( n ) a k x( n k ) bk y( n k )
x(n)

Ts

a0

x(n-1)

a1

Ts

x(n-2)

x(n-+1)

a2

Ts

a-1

x(n-)

y(n)

H ( z)
b

b-1

b2

b1

k
a
z
k
k 0
N

1 bk z k
k 1

y(n-)

Ts

y(n-+1)

y(n-2)

Ts

y(n-1)

Ts

11/31

Digital system z-Transform derivation


N

y( n ) a k x( n k ) bk y( n k )
k 0

z-transform both sides

k 1

Interchange
z y (n ) z ak x(n k ) z bk y (n k ) summations

n 0
n 0
k 0
n 0
k 1
n

k 0

n 0

k 1

n 0

Y ( z ) ak z x(n k ) bk z n y (n k ) Replace transforms


n

Y ( z ) ak X ( z k ) bkY ( z k )
k 0

Shift property

k 1

Y( z ) ak z

k 0

X ( z ) bk z k Y ( z )

Common factors

k 1

Y ( z ) X ( z ) ak z Y ( z ) bk z k
k 0

k 1

12/31

Digital system z-Transform derivation


M

Y ( z ) Y ( z ) bk z
k 1

X ( z ) ak z k

Common factors

k 0

Y ( z )(1 bk z ) X ( z ) ak z k
k

k 1

x(n)

k 0

Ts

a0

Y ( z)

X ( z)

a z
k 0
N

x(n-1)

a1

Ts

x(n-2)

x(n-+1)

a2

a-1

H ( z)

y(n)

Frequency
b

b-1

b2

b1

k 1

y(n-)

Ts

y(n-+1)

y(n-2)

Ts

y(n-1)

Ts

y( n ) a k x( n k ) bk y( n k )
k 0

x(n-)

1 bk z k
N

Ts

Time

k 1

13/31

Application
Find the impulse response h(n) and the input-output relationship of the filter
described by
1 z 1

H(z)

1 0.5z 1

Examine the stability of the filter and find its frequency response.
Solution

Y( z)
1 z 1
H(z)

1
X ( z ) 1 0.5z
1

z-1

x(n)
1

-1

Z 1

Y ( z ) 0.5Y ( z ) z X ( z ) X ( z ) z
y ( n ) 0.5 y ( n 1) x ( n ) x ( n 1)
y ( n ) x ( n ) x ( n 1) 0.5 y ( n 1)

y(n)
-0.5

z-1

h(n) is obtained from the terms of the polynomial which results after the division

(1 z 1 ) / (1 0.5z 1 ) 1 15
. z 1 0.75z 2 0.375z 3
14/31

Application
1 z 1
H(z)
1 0.5z 1

Im

Stable

|z|=1
1

Re

4.5

1.8

1.6

3.5

1.4

1.2

Phase

Magnitude

Frequency response
using MATLAB

2.5

0.8

1.5

0.6

0.4

0.5

0.2

0.1

0.2
0.3
Frequency

0.4

0.1

0.2
0.3
Frequency

0.4

15/31

Frequency on the Unit Circle


/2 or Fs/4
Im
z=ejt
|z|=1

or Fs/2

0
Re

1 z 1
H(z)
1 0.5z 1

The region from 0 to corresponds to the region 0Fs/2 of the Frequency response

16/31

Digital Filters
They are characterized by their
Impulse Response h(n), their
Transfer Function H(z) and their
Frequency Response H().
They can have memory, high
accuracy and no drift with time and
temperature.
They can possess linear phase.

They can be implemented by digital


computers.

17/31

Digital Filters - Categories


IIR

k 0

k 1

y( n ) a( k ) x( n k ) bk y( n k )

H(z)

ak z k

x(n)

k 0
M

1 bk z k
k 1

Ts

a0

x(n-1)

a1

Ts

x(n-2)

x(n-+1)

a2

Ts

aN-1

aN

y(n)

+
b

y(n-)

b-1

Ts

y(n-+1)

b2

y(n-2)

x(n-)

b1

Ts

y(n-1)

Ts

18/31

Digital Filters - Categories


N

k 0

k 0

y( n ) h( k ) x( n k ) a( k ) x( n k )
N

H ( z ) ak z

k 0

x(n)

a0
h(0)

Ts

x(n-1)

a1
h(1)

FIR

h( k ) z k
k 0

Ts

x(n-2)

a2
h(2)

x(n-+2)

a-2
h(-2)

Ts

x(n-+1)

a-1
h(-1)

y(n)

Stable
Linear phase
19/31

Digital Filters - Examples


a0 a1 z 1 a2 z 2
H(z)
1 b1 z 1 b2 z 2

0.5

k 0

h(1)=h(10)=-0.04506
h(2)=h(9)=0.06916
h(3)=h(8)=-0.0553

h(4)=h(7)=-.06342

-1
-2

0.1

0.2 0.3
Frequency

-3

0.4

1.5

k
Magnitude FIR

H ( z ) h( k ) z

Phase IIR

11

0.5

0.1

0.2 0.3
Frequency

0.4

0.1

0.2 0.3
Frequency

0.4

Phase FIR

a1=0.927,
b1=-0.674

Magnitude IIR

a0=0.498,
a2=0.498,
b2=-0.363.

1.5

0.1

0.2 0.3
Frequency

0.4

2
0
-2
-4

h(5)=h(4)=0.5789

20/31

IIR filter design


Design using the Bilinear z-transform, BZT
Design using the position of poles and zeros
on the unit circle
Im

Fs/2

Fs/4

|z|=1
1

-Fs/2
3Fs/4

The frequency response is zero at the


points of zeros
0 or Fs

The frequency response takes a peak at


the position of poles.
In order to have real coefficients of the
filter, the poles must appear in pairs. The
same happens for the zeros as well.

21/31

IIR Filter Design - position poles and zeros on the unit circle
Design a band-pass filter with the following specifications
Sampling frequency 1000Hz, full rejection at dc and 500 Hz, Narrow pass-band at
250 Hz, 20Hz 3dBs bandwidth.
18

Im

16
14

|z|=1
1

Magnitude

12
10
8

Re

6
4
2
0

0.1

0.2
0.3
Frequency

0.4

Zeros at 0 and Fs/2 or 180 (dc 0, 500/1000 Fs/2).


Poles at 250/1000 Fs/4 or 90 and complex conjugate at -90
The radius of poles should be smaller than 1 (stability)

r 1 (bw / Fs ) 1 (20 / 1000) 0.937


22/31

IIR Filter Design - position poles and zeros on the unit circle
x(n)

Im

z-2

|z|=1
1

y(n)
0.87

Re

z-2

y( n) x( n) x( n 2) 0.877969 y( n 2)
r 1 (bw / Fs ) 1 (20 / 1000) 0.937

( z 1)( z 1)
z2 1
1 z 2
H(z)
2

j / 2
j / 2
( z re
)( z re
) z 0.877969 1 0.877969 z 2
18

16

1.5

14

12
10

Phase

Magnitude

0.5

0
-0.5

6
-1

-1.5

2
0

0.1

0.2
0.3
Frequency

0.4

-2

0.1

0.2
0.3
Frequency

0.4

23/31

FIR filters
N

k 0

k 0

y( n ) h( k ) x( n k ) a( k ) x( n k )
x(n)

a0
h(0)

Ts

x(n-1)

a1
h(1)

Ts

H ( z ) ak z
k 0

x(n-2)

a2
h(2)

Stable
Linear phase

x(n-+2)

a-2
h(-2)

Ts

h( k ) z k
k 0

x(n-+1)

a-1
h(-1)

y(n)

Design Methods
Optimal filters
Windows method
Sampling frequency
24/31

Main categories of ideal filters


Low-pass

Band-pass

High-pass

|()|

|()|

|()|

0 c1 c2

()

()

j
0

-j
0

Differentiator

Hilbert Transformer

25/31

FIR filter design basic concept

1
jn
H
(

)
e
d
D

2
1 c jn

e d
2 c
2 f sin( n c )
c
n c

hD ( n )

c / 2

The filter coefficients result from the Inverse Fourier


Transform of the Desired Frequency Response.

h( n )

1 sin( n / 2)
2 ( n / 2)
26/31

FIR filter design Windows method


|HD()|

0.5

hD(n)

...
-

-/2

/2

...

Ts

|Ht()|

0.5

ht(n)

Gibbs phenomenon
-

-8

|W()|

0
1

w(n)

Hamming Window

-8

wR (n )

a (1 a ) cos(
0

2n
)
N

0.5 h(n)

|H()|
1

-8

27/31

FIR filter design Optimal filters


Parks and McClellan method.
Distributes Approximation error from the discontinuity
all over the frequency band.

28/31

FIR filter design Comparisons


0
Magnitude

0
-10
-20

-40
-60
-80

-30

Magnitude

-20

-40

100

200

300
Frequency

400

500

100

200

300
Frequency

400

500

-50

Phase

-60
-70

-80
-90

100

200

300
Frequency

400

-5

500

0.4
IR

Windows: 61 Coefficients
Parks and McClellan method: 46
and equiripple

0.2
0
-0.2

10

15

20

25
Time

30

35

40

45

29/31

FIR filters Linear phase


Linear phase is strictly related with the symmetry of the Impulse Response

( ) a

( ) b a
Condition

h( n) h( N n 1)

H ( ) h( k )e jkT
k 0

h( 0) h(1)e jT h( 2)e j 2T h(3)e j 3T h( 4)e j 4T h(5)e j 5T h( 6)e j 6T

h(0)(e

e j 3T h( 0)e j 3T h(1)e j 2T h( 2)e jT h(3) h( 4)e jT h(5)e j 2T h( 6)e j 3T


e j 3T

j 3T

e j 3T ) h(1)( e j 2T e j 2T ) h( 2)( e jT e jT ) h(3)

e j 3T 2h( 0)cos(3T ) 2h(1)cos( 2T ) 2h( 2)cos(T ) h(3)


The phase is introduced by the term e-j3T and equals
()=3= (7-1)/2
30/31

Linear phase - Same time delay


180o

3*180o

5*180o

If you shift in time one signal, then you have to shift the other signals the
same amount of time in order the final wave remains unchanged.
For faster signals the same time interval means larger phase difference.
Proportional to the frequency of the signals. -
31/31

You might also like