Vous êtes sur la page 1sur 31

Basics on Digital Signal Processing

z - transform - Digital Filters


Vassilis Anastassopoulos
Electronics Laboratory, Physics Department,
University of Patras
2/31
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

3/31
z-Transform
The z-transform is more general than the DFT
Time to frequency

=
1
0
2
) ( ) (
N
n
nk
N
j
e n x k X
t

=
1
0
) ( ) (
N
n
n
z n x z X
Time to z-domain (complex)
Transformation tool is the
complex wave



With amplitude |e
j
|=1
N k j j
e e
/ 2t e
=
Transformation tool is

With amplitude
changing(?) with time
o e e

+
= =
j j
e e z
4/31

R
I
z=R+jI
-z
|z|=1
The DFT is an expression of the z-transform on the unit circle.
z-Transform
For z=e
j
i.e. =1 we work on the
unit circle
And the z-transform degenerates
into the Fourier transform.

=
1
0
) ( ) (
N
n
n
z n x z X
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.
5/31
z-Transform convergence
We are interested in those values of z for which X(z) converges.
This region should contain the unit circle.

R
I
|a|
ROC
Why is it so?
The values of z for which X(z) diverges are
called poles of X(z).


=

= =
1
0
1
0
) (1/ ) ( ) ( ) (
N
n
n
N
n
n
z n x z n x z X
At z=0, X(z) diverges
6/31

R
I
|a|
ROC

a
a
2

a
3

a
4

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


=

= = =
0
1
0
1
0
) ( ) ( ) (
n
n
n
n n
N
n
n
az z a z n x z X
which for |az
-1
|<1 or |z|>|a| converges to
a z
z
az
z X

=
1
1
1
) (
The pole z=a, is never included in the ROC
7/31
Poles and zeros of X(z)

R
I
|a|
ROC
Poles: X(z)= Zeros: X(z)=0
For finite sequences, X(z) converges
everywhere except at z=0
For infinite sequences, X(z) converges
everywhere outside the circle with radius the
pole with maximum value.

1
3
5
3
1
n
x(n)
X z x n z z z z z z
n
n
( ) ( ) = = + + + +

1 2 3 4 5
3 5 3
For stable, causal digital systems the region of convergence includes the
Unit Circle so that the system possesses spectrum
8/31
M
N
N
N
z b z b z b b
z a z a z a a
z X


+ + + +
+ + + +
=

2
2
1
1 0
2
2
1
1 0
) (
z-Transform general form
Those values of z (z
i
) that make the nominator zero are called zeros.

While the poles are the values of z (p
i
) that make the denominator zero
and thus X(z) diverges.
) ( ) )( (
) ( ) )( (
) (
2 1
2 1
N
N
p z p z p z
z z z z z z k
z X


=

For stable, causal digital systems the region of convergence includes the
Unit Circle so that the system possesses spectrum
H e H z h n z h n e
j T
z e
n
n
z e
j T
n
j T
j T
( ) ( ) ( ) ( )
e e
e
e
= = =
=

=


9/31
A simple way to evaluate the signal from the X(z) is to perform the
division
X z
z z
z z
( )
.
=
+ +
+


1 2
1 0356
1 2
1 2
X z z z z ( ) . . = + + + +

1 3 36439 25756
1 2 3

The signal is x(0)=1, x(1)=3, x(2)=3.6439, x(3)=2.5756


Inverse z-Transform
10/31
z-Transform properties
Delay or Shift
) ( ) (
) ( ) (
z X z m n x
z X n x
m


x n X z
x n X z
ax n bx n aX z bX z
1 1
2 2
1 2 1 2
( ) ( )
( ) ( )
( ) ( ) ( ) ( )

+ +
Linearity
y n h k x n k Y z H z X z
k
( ) ( ) ( ) ( ) ( ) ( ) = =
=

Convolution
11/31

y(n-)
x(n-)
y(n-+1)
x(n-+1) x(n-2)
y(n-2) y(n-1)
x(n-1)
y(n)
x(n)
T
s

T
s
T
s
T
s

b
1

a
1
a
0

b
2

a
2
a
-1

b
-1
b


+
T
s
T
s

z-Transform and digital systems
y n a x n k b y n k
k
k
N
k
k
M
( ) ( ) ( ) =
= =

0 1

+
=
N
k
k
k
N
k
k
k
z b
z a
z H
1
0
1
) (
12/31
y n a x n k b y n k
k
k
N
k
k
M
( ) ( ) ( ) =
= =

0 1
Y z a z X z b z Y z
k
k
k
N
k
k
k
M
( ) ( ) ( ) =

=

0 1

=

=
M
k
k
n
n
N
k
k
n
n
n
n
k n y b z k n x a z n y z
1 0 0 0 0
) ( ) ( ) (


=

=
=
0 1 0 0
) ( ) ( ) (
n
n
M
k
k
n
n
N
k
k
k n y z b k n x z a z Y

= =
=
M
k
k
N
k
k
k z Y b k z X a z Y
1 0
) ( ) ( ) (
z-transform both sides
Replace transforms
Interchange
summations
Shift property
Digital system z-Transform derivation
Common factors

=

=
M
k
k
k
N
k
k
k
z b z Y z a z X z Y
1 0
) ( ) ( ) (
13/31
Digital system z-Transform derivation
) (
1
) (
) (
1
0
z H
z b
z a
z X
z Y
N
k
k
k
N
k
k
k
=
+
=

= +
N
k
k
k
M
k
k
k
z a z X z b z Y
0 1
) ( ) 1 )( (
Common factors

=

= +
N
k
k
k
M
k
k
k
z a z X z b z Y z Y
0 1
) ( ) ( ) (
y n a x n k b y n k
k
k
N
k
k
M
( ) ( ) ( ) =
= =

0 1

y(n-)
x(n-)
y(n-+1)
x(n-+1) x(n-2)
y(n-2) y(n-1)
x(n-1)
y(n)
x(n)
Ts
Ts Ts Ts
b1
a1 a0
b2
a2 a-1
b-1 b
a
+
Ts Ts
Time
Frequency
14/31
Application
Find the impulse response h(n) and the input-output relationship of the filter
described by
H z
z
z
( )
.
=

+

1
1 05
1
1
Examine the stability of the filter and find its frequency response.
H z
Y z
X z
z
z
Y z Y z z X z X z z
y n y n x n x n
y n x n x n y n
Z
( )
( )
( ) .
( ) . ( ) ( ) ( )
( ) . ( ) ( ) ( )
( ) ( ) ( ) . ( )
= =

+

+ =
+ =
=



1
1 05
05
05 1 1
1 05 1
1
1
1 1
1
Solution
y(n)
x(n)
z
-1
z
-1
-1
-0.5
( ) / ( . ) . . . 1 1 05 1 15 075 0375
1 1 1 2 3
+ = + +

z z z z z
h(n) is obtained from the terms of the polynomial which results after the division
15/31
Application
Im
Re
|z|=1
1
H z
z
z
( )
.
=

+

1
1 05
1
1
Stable
0 0.1 0.2 0.3 0.4
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
Frequency
M
a
g
n
i
t
u
d
e
0 0.1 0.2 0.3 0.4
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
Frequency
P
h
a
s
e
Frequency response
using MATLAB
16/31

Im
Re
|z|=1
0
/2 or F
s
/4
or F
s
/2
z=e
jt

H z
z
z
( )
.
=

+

1
1 05
1
1
The region from 0 to corresponds to the region 0-
F
s
/2 of the Frequency response
Frequency on the Unit Circle
17/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.
18/31
Digital Filters - Categories
IIR y n a k x n k b y n k
k
N
k
k
M
( ) ( ) ( ) ( ) =
= =

0 1
H z
a z
b z
k
k
k
N
k
k
k
M
( ) =
+

0
1
1

y(n-)
x(n-)
y(n-+1)
x(n-+1) x(n-2)
y(n-2) y(n-1)
x(n-1)
y(n)
x(n)
T
s

T
s
T
s
T
s

b
1

a
1
a
0

b
2

a
2
a
N-1

b
-1
b


a
N

+
T
s
T
s

19/31
FIR
Digital Filters - Categories
y n h k x n k a k x n k
k
N
k
N
( ) ( ) ( ) ( ) ( ) = =
= =

0 0
H z a z h k z
k
k
k
N
k
k
N
( ) ( ) = =

=

0 0

x(n-+1) x(n-+2) x(n-2)
x(n-1)
y(n)
x(n)
T
s

a
-1

h(-1)
a
-2

h(-2)
a
2

h(2)
a
1

h(1)
a
0

h(0)
+
T
s
T
s

Stable
Linear phase
20/31
Digital Filters - Examples
0 0.1 0.2 0.3 0.4
0
0.5
1
1.5
Frequency
M
a
g
n
i
t
u
d
e

I
I
R
0 0.1 0.2 0.3 0.4
-3
-2
-1
0
1
Frequency
P
h
a
s
e

I
I
R
0 0.1 0.2 0.3 0.4
0
0.5
1
1.5
Frequency
M
a
g
n
i
t
u
d
e

F
I
R
0 0.1 0.2 0.3 0.4
-4
-2
0
2
4
Frequency
P
h
a
s
e

F
I
R
H z
a a z a z
b z b z
( ) =
+ +
+ +


0 1
1
2
2
1
1
2
2
1
H z h k z
k
k
( ) ( ) =

=

0
11
a
0
=0.498, a
1
=0.927,
a
2
=0.498, b
1
=-0.674
b
2
=-0.363.

h(1)=h(10)=-0.04506
h(2)=h(9)=0.06916
h(3)=h(8)=-0.0553
h(4)=h(7)=-.06342
h(5)=h(4)=0.5789
21/31
IIR filter design
Design using the Bilinear z-transform, BZT
Design using the position of poles and zeros
on the unit circle

Im
3F
s
/4
F
s
/4
-F
s
/2
F
s
/2
0 or F
s

|z|=1
1
The frequency response is zero at the
points of zeros
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.
22/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.
0 0.1 0.2 0.3 0.4
0
2
4
6
8
10
12
14
16
18
Frequency
M
a
g
n
i
t
u
d
e

Zeros at 0 and F
s
/2 or 180

(dc 0, 500/1000 F
s
/2).
Poles at 250/1000 F
s
/4 or 90

and complex conjugate at

-90


The radius of poles should be smaller than 1 (stability)
r bw F
s
~ = = 1 1 20 1000 0937 ( / ) ( / ) . t t

Im
Re
|z|=1
1
23/31
IIR Filter Design - position poles and zeros on the unit circle

y(n)
x(n)
0.87
z
-2

z
-2


Im
Re
|z|=1
1
H z
z z
z re z re
z
z
z
z
j j
( )
( )( )
( )( ) . .
/ /
=
+

=

+
=

+

1 1 1
0877969
1
1 0877969
2 2
2
2
2
2 t t
937 . 0 ) 1000 / 20 ( 1 ) / ( 1 = = ~ t t
s
F bw r
0 0.1 0.2 0.3 0.4
0
2
4
6
8
10
12
14
16
18
Frequency
M
a
g
n
i t u
d
e
0 0.1 0.2 0.3 0.4
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
Frequency
P
h
a
s
e
y n x n x n y n ( ) ( ) ( ) . ( ) = 2 0877969 2
24/31
FIR filters
y n h k x n k a k x n k
k
N
k
N
( ) ( ) ( ) ( ) ( ) = =
= =

0 0
H z a z h k z
k
k
k
N
k
k
N
( ) ( ) = =

=

0 0

x(n-+1) x(n-+2) x(n-2)
x(n-1)
y(n)
x(n)
T
s

a
-1

h(-1)
a
-2

h(-2)
a
2

h(2)
a
1

h(1)
a
0

h(0)
+
T
s
T
s

Stable
Linear phase
Design Methods
Optimal filters
Windows method
Sampling frequency
25/31
Main categories of ideal filters
0

0
1
|()|
2

c

0
1
|()|
2

c1

c2

0
1
|()|
2

c

0
j
()
2

-j
j
()
2

Low-pass Band-pass High-pass
Differentiator
Hilbert Transformer
26/31
FIR filter design basic concept
The filter coefficients result from the Inverse Fourier
Transform of the Desired Frequency Response.
h n H e d
e d
f n
n
D D
j n
j n
c c
c
c
c
( ) ( )
sin( )
= =
= =
=

}
}
1
2
1
2
2
t
e e
t
e
e
e
t
t
e
e
e
e


h n
n
n
( )
sin( / )
( / )
=
1
2
2
2
t
t
e t
c
= / 2
27/31

-/2 /2
1
- 0
|H
D
()|
1
- 0
|H()|
1
- 0
|H
t
()|
1
- 0
|W()|
0.5
0.5
h
t
(n)
w(n)
1
0
0.5
-8
-8
-8
h(n)
8
8
8
T
s

... ...
h
D
(n)
FIR filter design Windows method

+
=
0
)
2
cos( ) 1 (
) (
N
n
a a
n w
R
t
Gibbs phenomenon
Hamming Window
28/31
FIR filter design Optimal filters
Parks and McClellan method.
Distributes Approximation error from the discontinuity
all over the frequency band.
29/31
0 100 200 300 400 500
-80
-60
-40
-20
0
Frequency
M
a
g
n
i
t
u
d
e
0 100 200 300 400 500
-5
0
5
Frequency
P
h
a
s
e
0 5 10 15 20 25 30 35 40 45
-0.2
0
0.2
0.4
Time
I
R
0 100 200 300 400 500
-90
-80
-70
-60
-50
-40
-30
-20
-10
0
Frequency
M
a
g
n
i
t
u
d
e
Windows: 61 Coefficients
Parks and McClellan method: 46
and equiripple
FIR filter design Comparisons
30/31
FIR filters Linear phase
Linear phase is strictly related with the symmetry of the Impulse Response
H h k e
h h e h e h e h e h e h e
e h e h e h e h h e h e h
j kT
k
j T j T j T j T j T j T
j T j T j T j T j T j T
( ) ( )
( ) ( ) ( ) ( ) ( ) ( ) ( )
( ) ( ) ( ) ( ) ( ) ( )
e
e
e e e e e e
e e e e e e
= =
= + + + + + +
= + + + + + +

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

= + + + + + +
= + + +
e
e e e e e e e
e
e e e
u e e ( ) = a u e e ( ) = b a
h n h N n ( ) ( ) = 1 Condition
The phase is introduced by the term e
-j3T
and equals
()=3= (7-1)/2
31/31
Linear phase - Same time delay
180
o
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. -
5*180
o
3*180
o

Vous aimerez peut-être aussi