Sie sind auf Seite 1von 163

LECTURE NOTES ON

DIGITAL
SIGNAL
PROCESSING
Prof. Dr. A. Salim KAYHAN
Hacettepe University
Department of Electrical and Electronics Engineering
ANKARA-2014

ELE 407
Digital Signal Processing
Fall 2014
Place: E-?
Time: Wednesday 13:00-15:50
Course Outline:
W1-Sep.24
W2-Oct.01
W3-Oct.08
W4-Oct.15

Review of Discrete-time signals, systems, Fourier, Z-tr.


Sampling, Decimation, Interpolation.
Frequency Response .
Relation Between Magnitude and Phase, Flow Graph
Realization.
W5-Oct.22 Flow Graph Realization of FIR sys., Quantization.
W6-Oct.29 No Class. (Holiday)
W7-Nov.05 EXAM
W8-Nov.12 Butterworth and Chebyshev Filter Design.
W9-Nov.19 Butterworth and Chebyshev Filter, FIR Filter Design.
W10-Nov26 Discrete-time Fourier Series, DFT, Properties of DFT.
W11-Dec03 Convolution with DFT (Overlap-add/save). FFT.
W12-Dec10 Fast Fourier Transform(FFT).
W13-Dec17 EXAM.
W14-Dec24 2-D Signal Processing.
Textbook:
Discrete-time Signal Processing, Oppenheim and Schafer, Prentice-Hall.
Grading: 2Term Exams (50%), Final Exam (50%).

DIGITAL
SIGNAL
PROCESSING

Textbook: Discrete-Time Signal Processing, Oppenheim and Schafer, Prentice-Hall.

Digital Signal Processing

A.S.Kayhan

Course Outline
Review

of Discrete-time signals, systems, Fourier tr.

Review

of Z-transform

Sampling,

Decimation, Interpolation

Time

and frequency response of systems

Flow

Graph Realization

Filter

Design

Discrete-time

Fourier Series, Discrete Fourier Transform

Fast

Fourier Transform

2-D

Signal Processing
Digital Signal Processing

A.S.Kayhan

SIGNALS:A signal is a function of time representing a physical


variable, e.g. voltage, current, spring displacement, share market prices, number
of students asleep in the class, cash in the bank account.

Continuous time signals : x(t), x(t1,t2,...)


Speech signals, Image signals,
Video signals, Seismic signals,
Biomedical signals (ECG,EEG,...)
Discrete-time signals: x[n], x[n1,n2,...]
Inherently discrete-time (Stock market)
Discretized continuous-time(Most signals)
Digital Signal Processing

A.S.Kayhan

SIGNALS:Deterministic or Random

Digital Signal Processing

A.S.Kayhan

Speech data (8kHz):

Digital Signal Processing

A.S.Kayhan

Discrete-time signal example:


Stock Market daily closing values

Digital Signal Processing

A.S.Kayhan

Annual max. temperature and precipitation for Ankara


(data: MGM)

Digital Signal Processing

A.S.Kayhan

Graphical Representation of Signals


Continuous-time
Signal

Discrete-time
Signal

Digital Signal Processing

A.S.Kayhan

Reflection: x[-n]

Digital Signal Processing

A.S.Kayhan

Time-scaling: x(at)

Time-scaling in discrete-time is not straightforward.


Discussed in Decimation and Interpolation.

Digital Signal Processing

A.S.Kayhan

Time-shift: x[n-no]

Digital Signal Processing

A.S.Kayhan

Basic Discrete-time Signals:


Unit Step Function :
0,
u[n]
1,

n 0
n 0

Digital Signal Processing

A.S.Kayhan

Unit Impulse Function:


0,
[n ]
1,

n 0
n 0

[ n ] u [ n ] u [ n 1]
n

u[n]

[k ]

x [ n ] [ n ] x [ 0 ] [ n ]
Digital Signal Processing

Real Exponential:

x[n ] C en C a

Digital Signal Processing

A.S.Kayhan

A.S.Kayhan

x [ n ] A e j o n
x [ n ] A cos( o n )

Complex Exponential:
Sinusoidal Signal:
x [ n ] Re

j ( o n )

{ Ae

Digital Signal Processing

A.S.Kayhan

Periodicity Properties:
e

j (

2 ) n

j o n

Therefore, consider only

If periodic, then
e

(n N )
j

j o n

0 2

m
N

m and N integer.
Digital Signal Processing

A.S.Kayhan

If periodic with fundamental period N,


then fundamental frequency is
2 / N
If there are a few exponentials in the form:
xk [n] e

jk

2
n
N

they are harmonically related


There are only N such distinct signals.

Digital Signal Processing

A.S.Kayhan

SYSTEM:
Any process that transforms signals

Digital Signal Processing

A.S.Kayhan

Digital Signal Processing

A.S.Kayhan

Interconnection of Systems:
Series(Cascade), Parallel, Series/Parallel.

Digital Signal Processing

A.S.Kayhan

10

Properties:
Memoryless if output depends only on
input at the same time.
Example: Discrete-time systems with memory:
n

y[ n ]

x[ k ]

y[ n ] x[ n 1]

Digital Signal Processing

A.S.Kayhan

Causality: Causal if output depends only on inputs


at the present time and in the past.

Digital Signal Processing

A.S.Kayhan

11

Example: Causal system:

y[ n ] x[ n ] x[ n 1]

1
y (t )
C

x( )d

Example: Noncausal systems:

y[ n ] x[ n 1] x[ n ]
M
1
y[ n ]
x[ n k ]
2 M 1 k M

Digital Signal Processing

A.S.Kayhan

Stability: Stable if small inputs do not lead to


diverging outputs.

Digital Signal Processing

A.S.Kayhan

12

Example: Stable system:

y[ n ] x[ n ] x[ n 1]

Example: Unstable systems:


n

y[ n ]

x[ k ] ( n 1)u[ n ],

if x[ n ] u[ n ].

Digital Signal Processing

A.S.Kayhan

Time Invariance: Time-invariant if a time shift in


input causes same time shift in output signal.

Digital Signal Processing

A.S.Kayhan

13

y[ n ] nx [ n ]

Example:Time-varying:
Consider two signals

x1 [ n ],

x 2 [ n ] x1 [ n n o ]

y 2 [ n ] nx 2 [ n ]

y1 [ n ] nx1 [ n ]
shift

y 2 [ n ] nx 1[ n n o ]

y1 [ n ]

y1 [ n n o ] ( n n o ) x1 [ n n o ] y 2 [ n ]

Digital Signal Processing

A.S.Kayhan

Linearity: Linear if posses superposition property:


Additivity and scaling (homogeneity):
1. Response to x [ n ] x [ n ]is y1[ n ] y 2 [ n ]
1
2
2. Response to
ax 1 [ n ]is
ay 1 [ n ]
Combining these two, we get:

ax1[ n ] bx 2 [ n ] ay 1[ n ] by 2 [ n ]
Example: Linear:

y[ n ] nx [ n ]

Example: Nonlinear:

y[ n ] ( x[ n ]) 2

Digital Signal Processing

A.S.Kayhan

14

Linear Time-Invariant Systems:


LTI systems can be analyzed in great detail.
Many physical processess can be modeled by LTI
systems.
Unit impulse function will be used as building block
and response of LTI systems to a unit impulse will be
used to characterize such systems.

Digital Signal Processing

A.S.Kayhan

Input/output relationship for a LTI system is given as:

y[ n ]

x[ k ]h[ n k ]

y[ n ] x[ n ] * h[ n ]
Convolution of x[n] and h[n]. h[n] is the impulse response.

Digital Signal Processing

A.S.Kayhan

15

Example:

Digital Signal Processing

A.S.Kayhan

Properties:
Commutative:

x[ n ] * h[ n ] h[ n ] * x[ n ]

x[ k ]h[ n k ]

r n k

x[ n r ]h[ r ]

Use of this property:


If it is easier; reflect and shift x[k] to obtain x[n-k] first, then
multiply with h[k] to find convolution result at time n.

Digital Signal Processing

A.S.Kayhan

16

Associative:

x[ n ] * ( h1 [ n ] * h2 [ n ]) ( x[ n ] * h1 [ n ]) * h2 [ n ]

Digital Signal Processing

A.S.Kayhan

Distributive:

x[ n ] * ( h1 [ n ] h2 [ n ]) x[ n ] * h1 [ n ] x[ n ] * h2 [ n ]

Digital Signal Processing

A.S.Kayhan

17

Memory: System is memoryless if output depends only


on input at same time.Then, system is memoryless if:

h[ n ] K [ n ]
then

y[ n ] Kx [ n ].

Similarly for continuous-time, memoryless if

y ( t ) Kx ( t ).
hence

h (t ) K (t )

Digital Signal Processing

A.S.Kayhan

Causal: Consider convolution sum :

y[ n ]

h[ k ] x[ n k ]

For a LTI system to be casual y[n] must not depend on


input x[k] for k > n.
If system is causal :
h [ n ] 0 , for n 0 .
Then,

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

x[ k ]h[ n k ]

Digital Signal Processing

A.S.Kayhan

18

Stability: Stable if bounded inputs do not lead to


diverging outputs. Assume
x[ n ] B ,

for all n .

Then,

h[ k ] x[ n k ]

y[ n ]

y[ n ]

h[ k ] x[ n k ]

x[ n k ] B

with,

y[ n ] B

h[ k ]

h[ k ]

System is stable iff,

Digital Signal Processing

A.S.Kayhan

Example: A system with impulse response h[n]=[nno] shifts the input

h[ n ]

[n n

] 1

Example: Consider the fallowing accumulator


n

y[ n ]

x[ k ]

this system has unit step as the impulse response

u[ n ] u[ n ] Unstable
n0

Digital Signal Processing

A.S.Kayhan

19

Discrete-Time Fourier Transform (DTFT):


For a discrete-time signal x[n], DTFT is defined as

X (e

x [ n ]e

j n

the inverse DTFT (synthesis equation) is defined as


1
2

x[n ]

(e

)e

j n

Differences between continuous-time FT and DTFT:


X(ej) is periodic with 2.
Integral in synthesis eq. is over 2 interval (0 to 2 or - to
).
Digital Signal Processing

A.S.Kayhan

x [ n ] a n u [ n ],

Example:Consider

a 1

X (e

a ne

( ae

j n

u[n]

X (e

n0

X (e

X (e

X (e

)n

1
1 ae

1
(1 a cos( )) ja sin( )
1

2
1 a 2 a cos( )

) tan

a sin( )

1 a cos( )

Digital Signal Processing

A.S.Kayhan

20

Digital Signal Processing

A.S.Kayhan

Common DTFT Pairs:

x [ n ] 1 , for all n X ( e

2 ( 2 l )

x[ n ] [ n ] X ( e

) 1

x[ n ] e

j o n

X ( e

2 ( o 2 l )

x [ n ] cos( o n )

X (e

[ (

2 l ) (

2 l )]

Digital Signal Processing

A.S.Kayhan

21

Convergence: Analysis equation will converge if x[n] is


absolutely summable or it has finite energy

x[ n ]

x[n ]

Example:Consider

1, n N
x[ n ]
0, n N

X (e

j n

n N

j N

1 e j ( 2 N
1 e j

1)

sin( ( N 1 / 2 ))
sin( / 2 )

Digital Signal Processing

A.S.Kayhan

Digital Signal Processing

A.S.Kayhan

22

Properties of DTFT:
Linearity: DTFT is linear operator:
x [ n ] X ( e j )
y[n ] Y (e

ax [ n ] by [ n ] a X ( e

) b Y (e

Time and frequency shifting:


x[n ] X (e
x[n n o ] e
e

j o n

j n o

x[ n ] X ( e

X (e

j (

j
)

Digital Signal Processing

Symmetry: If x[n] is real, then


X ( e j ) X * ( e

A.S.Kayhan

Real part is even, imaginary part is odd function of .


Similarly, magnitude is even, phase is odd funtion.
Time and frequency scaling: Time scaling is not
straightforward for discrete-time signals. Consider special case;
x[an], a = -1
x [ n ] X ( e j )
x [ n / k ], if n is multiple
x1[ n ]
0, if n is not multiple
X 1 ( e j ) X ( e jk )

of k
of k

Digital Signal Processing

A.S.Kayhan

23

Parsevals relation: Energy is equal on both time and


frequency domains:
2

x[n ]

1
2

X (e

Since the right hand term is the total energy in frequency


2
domain,
X ( e j ) is called energy spectral density
function (or spectrum).
Convolution: Convolution in time corresponds to
multiplication in frequency domain.
y [ n ] x[ n ] * h[ n ] Y (e

) X (e

) H (e

Digital Signal Processing

where,

H (e

H (e

A.S.Kayhan

) is the frequency response defined as

j n

h [ n ]e

Example:Consider a LTI sytem with


Then the frequency response is
H (e

) e

h[n ] [n no ]

j n o

j
X ( eFourier
)

For any input x[n] with Fourier transform


transform of output
Y (e

) e

j n o

X (e

The output is equal to the input with a time shift


y [ n ] x [ n n o ].
Digital Signal Processing

A.S.Kayhan

24

Example:Consider a LTI sytem with |a|,|b| <1

h[ n ] a n u[ n ]
H (e

x[ n ] b n u [ n ]

1
1 ae

X (e

1
1 be

then
1
1
1 ae j 1 be j
y[n] is found taking inverse Fourier transform (partial
fraction):
Y (e

y[ n ]

1
[ a n 1 b n 1 ]u[ n ].
ab
Digital Signal Processing

A.S.Kayhan

Multiplication (Modulation): Multiplication in time


corresponds to convolution in frequency domain:
x[ n ]h[ n ]

1
2

(e

) H (e

j ( )

)d

This is periodic convolution over 2 interval.

Digital Signal Processing

A.S.Kayhan

25

Z- Transform :
For a discrete-time signal x[n], z-transform is defined as

X (z)

x[n ]z n

z is a general complex variable shown in polar form as


z r e j
We get Fourier transform
as a special case when r=1

Digital Signal Processing

A.S.Kayhan

Convergence: Z-transform exists if

| x[ n ] r

Poles-Zeros: consider X(z) as a rational function


P (z)
X (z)
Q (z)
where P(z) and Q(z) are
polynomials in z. Values of z
making X(z)=0 are called zeros of
X(z) (roots of P(z)).Values of z
making X(z)= are called poles of
X(z) (roots of Q(z)).
Digital Signal Processing

A.S.Kayhan

26

Digital Signal Processing

A.S.Kayhan

Digital Signal Processing

A.S.Kayhan

27

x[ n ] a nu [ n ]

Example: Consider

X (z)

a u[n ]z

( az

)n

n0

For convergence

| az

X (z)

1
1 az

z
, | z | | a |
z a

Digital Signal Processing

A.S.Kayhan

Example: Consider
x [ n ] a n u [ n 1]

X (z) 1

(a

z)n

n0

For convergence

|a

z |

X (z) 1

1
1 a

z
, | z | | a |
z a

Digital Signal Processing

A.S.Kayhan

28

Example: Consider
x [ n ] a n u [ n ] b n u [ n 1 ],
a nu[n ]

b a

z
, | z | | a |
z a

b n u [ n 1]

z
, | z | | b |
z b

Then
X (z)

z
z

, | a | | z | | b |
z a
z b

Digital Signal Processing

A.S.Kayhan

Digital Signal Processing

A.S.Kayhan

29

Properties of convergence:
ROC is a ring or disk centered at origin.
DTFourier transform exists if ROC includes Unit Circle
ROC can not contain any poles
If x[n] has finite duration ROC is entire plane.
If x[n] is right-sided, ROC is outward from outermost pole
If x[n] is left-sided, ROC is inward from innermost pole
If x[n] is two-sided, ROC is a ring not containing any pole.

Digital Signal Processing

A.S.Kayhan

Example:
x [ n ] ( 0 . 4 ) n u [ n ] ( 2 ) n u [ n 1 ],
X (z)

z
z

, | 0 . 4 | | z | | 2 |
z 0 .4
z 2

Digital Signal Processing

A.S.Kayhan

30

Transfer Function: Z-transform of impulse response h[n]

H (z)

h[n ]z n

If impulse response h[n] is causal then ROC will be outward.


If the system is causal and stable, all the poles will be inside the
unit circle and ROC will include the unit circle.

Digital Signal Processing

A.S.Kayhan

Inverse Z-Transform:
Power Series Expansion: Consider
X (z) z2

remember

1
1 1
z 1
z
2
2

X (z)

x[n ]z n

x [ 2 ] z 2 x [ 1 ] z 1 x [ 0 ] z 0 x [1 ] z 1

therefore
1
1
x[ n ] [ n 2 ]
[ n 1] [ n ] [ n 1]
2
2
Digital Signal Processing

A.S.Kayhan

31

Example (Long Division): |z| > |a|


1
X (z)
1 az 1 a 2 z 2 a 3 z 3
1
1 az
therefore x [ n ] a n u [ n ]
Example (Long Division): |z| < |a|
z
X (z)
a 1 z a 2 z 2 a 3 z 3
a z
x[ n ] a n u [ n 1]

therefore

Digital Signal Processing

A.S.Kayhan

Partial fraction expansion: Consider


M

X (z)

bk z k

a k z k

k 0
N

k0

k 1

1
b o k 1 (1 c k z )

N
ao
(1 d k z 1 )
k 1

Ak
, A k (1 d k z 1 ) X ( z ) | z d k
1
1 dkz

then

x[ n ]

A k d kn u [ n ]

k 1

Digital Signal Processing

A.S.Kayhan

32

Example : Consider
1
1
X (z)
, | z |
.
1 1
1 1
2
(1
z )( 1
z )
4
2
A1
A2
X (z)

1 1
1 1
(1
z )
(1
z )
4
2
1 1
A 1 (1
z ) X ( z ) | z 1 / 4 1
4
1 1
A 2 (1
z ) X ( z ) | z 1 / 2 2
2
n
n
1
1
x[ n ] 2 u [ n ] u [ n ]
2
4
Digital Signal Processing

A.S.Kayhan

Properties of Z-Transform:
Linearity:
x[n ] X ( z )
y[n ] Y ( z )
ax [ n ] by [ n ] a X ( z ) b Y ( z )
ROC R x R y

Time shift:
x[ n ] X ( z )
y [ n ] x[ n n 0 ] Y ( z ) z no X ( z )
ROC

Rx

Digital Signal Processing

A.S.Kayhan

33

Multiplication by Exponential:
x[ n ] X ( z )
z on x [ n ] X ( z / z o )
ROC

| zo | R x

Conjugation:
x *[n ] X
ROC R x

(z*)

Digital Signal Processing

A.S.Kayhan

Time reversal:
x * [ n ] X * (1 / z * )
ROC 1 / R x
x [ n ] X (1 / z )
ROC 1 / R x

Convolution:
y [ n ] * x [ n ] X ( z )Y ( z )
ROC R x R y

Digital Signal Processing

A.S.Kayhan

34

Example: x [ n ] a n u [ n ]

h[n ] u[n ]

y[ n ] x[ n ] * h[ n ]
X (z)

z
, | z | | a |
z a

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


Y (z)

H (z)

z
, | z | | 1 |
z 1

z2
, | z | | 1 |
( z a )( z 1 )

1
1
a

1 a 1 z 1
1 az

y[n] is obtained as:


y[n ]

1
(u [n ] a
1 a

n 1

u [ n ])

Digital Signal Processing

A.S.Kayhan

Sampling:
Consider a signal x[n] which is obtained by taking samples
of a continuous time signal xc(t):
x [ n ] x c ( nT )
where T is the sampling period, its reciprocal,
the sampling frequency.

Digital Signal Processing

fs 1

T is

A.S.Kayhan

35

Digital Signal Processing

A.S.Kayhan

Digital Signal Processing

A.S.Kayhan

36


where x [ n ] Q ( x [ n ])
has the quantized samples and
xB[n] has the coded samples (such as 2s complement).

Digital Signal Processing

A.S.Kayhan

Digital Signal Processing

A.S.Kayhan

37

Digital Signal Processing

A.S.Kayhan

Frequency Domain Representation of Sampling:


Consider the sampled signal xs(t) obtained from xc(t) by
multiplying with periodic impulse train:

s (t )

( t nT )

then

x s (t ) x c (t ) s (t ) x c (t )

( t nT )

The discrete time signal is x[n]= xc(nT). The


Fourier transform of s(t) is
2
S ( )
T

( k s ),

Digital Signal Processing

A.S.Kayhan

38

Then, Fourier transform of xs(t) is


1
1
X s ( )
X ( ) * S ( )
2
T

X c ( k s )

Digital Signal Processing

A.S.Kayhan

We observe that when the sampling frequency is not


chosen high enough, copies of spectrum overlap; this is
called aliasing (distortion).
The minimum sampling frequency (rate) to avoid
aliasing is 2N (Nyquist rate) :

2
2
T

Digital Signal Processing

A.S.Kayhan

39

If sampling rate is greater than Nyquist rate, then the


original signal xc(t) may be obtained without distortion
using a low-pass filter.

Digital Signal Processing

A.S.Kayhan

x s (t )

x c ( t ) ( t nT )

Fourier Tr. of xs(t) may be written as

x c ( nT ) e

X s ( )

j Tn

On the other hand DTFT of x[n] is


X ( e j ) x [ n ]e

j n

Comparing these equations we observe that


X s ( ) X ( e j ) | T X ( e j T )
X (e

X (e

j T

1
T

1
T

X c ( k s )

X c(

2 k

)
T
T

Digital Signal Processing

A.S.Kayhan

40

Example:Consider
x c ( t ) cos o t

Digital Signal Processing

A.S.Kayhan

x r ( t ) cos( o t )

x r ( t ) cos((

o )t )

Digital Signal Processing

A.S.Kayhan

41

Example: Consider
x c ( t ) cos o t ,

4000

with sampling period T=1/6000, we obtain


2

x [ n ] cos 4000 nT cos


n
3

2
s
12000 2 o 8000
T
Nyquist sampling condition is satisfied , there is no
aliasing.

Digital Signal Processing

Example: Consider
x c ( t ) cos o t ,

A.S.Kayhan

16000

with sampling period T=1/6000, we obtain


2
s
12000 2 o 16000
T
x [ n ] cos 16000 nT
cos

2 n

cos 16000 n / 6000

4000 n / 6000

cos
n
3

Nyquist sampling condition is not satisfied , there is


aliasing.

Digital Signal Processing

A.S.Kayhan

42

Reconstruction from Samples:


Use ideal LPF to recover original signal

Digital Signal Processing

With

A.S.Kayhan

x s (t )

x c ( nT ) ( t nT )

x [ n ] ( t nT )

x r (t )

x [ n ] h ( t nT )

h ( t ) sinc

x r (t )

t T

t nT
x [ n ] sinc

Digital Signal Processing

A.S.Kayhan

43

Digital Signal Processing

A.S.Kayhan

Discrete-time Processing of Cont.-time Signals:

h[n ]

with h(t) is impulse response of continuous-time system


h [ n ] T h c ( nT )
H (e

) H c(

)
T

Digital Signal Processing

A.S.Kayhan

44

Changing the Sampling Rate:


Downsampling and Decimation:
Sampling rate can be reduced by further sampling in
discrete-time:
x d [ n ] x [ nM ] x c ( nMT )
Let

T ' MT

x d [ n ] x c ( nT ' )

Then

Digital Signal Processing

If X c ( ) 0 ,

for

and

A.S.Kayhan

2
2

T '
MT

2
2 N
(N is BW of x[n])
M
Then xc(t) can be recovered without distortion.

or

Remember that
X (e
Similarly
X
X

(e
(e

)
j

1
T

X c(

2 k

)
T
T

2k
X c(

T ' k
T '
T '

2 k
)
X c(

MT k
MT
MT
)

Digital Signal Processing

A.S.Kayhan

45

Let

n 0 ,
x [ n ],
x1[ n ]
otherwise
0,
1 M 1 j 2 l n / M
x1[ n ] x [ n ]
e
M l0

M , 2 M ,

, n

( [ ]=Discrete Fourier Series rep. of impulse train with period M )

x d [ n ] x 1 [ Mn ] x [ Mn ]

(e

xd [n] e

j n

x 1 [ Mn ] e

j n

k Mn n k / M

(e

j k / M

x1[ k ] e

Digital Signal Processing

(e

1
M

M 1

l0

M 1

1
x[n ]
M

A.S.Kayhan

j 2 lk / M

l0

x [ k ]e
k

j 2 lk / M

j k / M

j k / M

Combining the exponential terms


X

(e

1
)
M

First obtain X ( e

M 1

X (e

j(

2l

)
M
M

l0

2 increments to get

)then shift by

X (e

j ( ' 2 l / M )

Digital Signal Processing

A.S.Kayhan

46

Digital Signal Processing

A.S.Kayhan

Digital Signal Processing

A.S.Kayhan

47

If 2 2
M

Digital Signal Processing

A.S.Kayhan

A general system for downsampling called decimator is

Digital Signal Processing

A.S.Kayhan

48

Upsampling and Interpolation:


Sampling rate can be increased by obtaining intermediate
values:
x i [ n ] x c ( nT ' ), T ' T / L , L 2
given x [ n ] x c ( nT ).
x i [ n ] x [ n / L ] x c ( nT / L ),

n 0 , L , 2 L ,

Consider the following system

Digital Signal Processing

A.S.Kayhan

The block with L inserts (L-1) zeros between samples:


x n / L , n 0 , L , 2 L
xe[n]
0,
otherwise

or

xe[n ]

x k n

kL .

In frequency domain:

X e (e

x k n

kL e

j n

X e (e

x k e

j kL

X (e

j L

Digital Signal Processing

A.S.Kayhan

49

L=2

Digital Signal Processing

h n

sin n / L
n / L

xi[n]

x[ k ]

A.S.Kayhan

sin ( n kL ) / L
( n kL ) / L

Digital Signal Processing

A.S.Kayhan

50

Changing the sampling rate by noninteger factor:


Following system may be used

Digital Signal Processing

A.S.Kayhan

Digital Signal Processing

A.S.Kayhan

51

End of Part 1

Digital Signal Processing

A.S.Kayhan

52

DIGITAL
SIGNAL
PROCESSING
Part 2
Digital Signal Processing

A.S.Kayhan

Frequency Analysis of LTI Systems:


the Input/Output (I/O) relation of a LTI system is given
by convolution:

y[ n ] x[ n ] * h[ n ]

h[ k ] x[n k ]

In z-domain

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

On the unit circle


Y (e

where H ( e
system.

) X (e

) H (e

ze

is the frequency response of the

Digital Signal Processing

A.S.Kayhan

Magnitude is
Y (e

where H ( e
system.

) X (e

) H (e

is the magnitude response of the

Phase is Y ( e
where H ( e
system.

) X (e

) H (e

) is the phase response of the

Digital Signal Processing

A.S.Kayhan

Discrete-time ideal filters: LPF, HPF, BPF:

These are not realizable. Why?


Digital Signal Processing

A.S.Kayhan

Phase distortion and delay:


Assume that h id [ n ] [ n n d ]
then
or

H
H

id

id

(e

(e

j n d

) e

) 1,

id

(e

) nd

Linear phase distortion causes simple delay.


Group delay:
It measures linearity of the phase response.
Consider
x [ n ] s [ n ] cos o n
where s [ n ] is a narrowband (slowly varying) signal.

Digital Signal Processing

Assume around
H (e

H (e

) 1,

A.S.Kayhan

) o n d

Then
y [ n ] s [ n n d ] cos o n o o n d

Thus, group delay of a system is


grd [ H ( e

where arg H ( e

)]

d
d

arg H

(e

is the continuous phase.

Digital Signal Processing

A.S.Kayhan

Digital Signal Processing

A.S.Kayhan

Example: Consider the following filter

Digital Signal Processing

A.S.Kayhan

Input is the following signal

Digital Signal Processing

Pulses are at

0 . 25 ,

0 .5 ,

Digital Signal Processing

A.S.Kayhan

0 . 85

A.S.Kayhan

Systems with Difference Equation Models:


Assume that the Input/Output (I/O) relation of a system
is given by a constant coefficient difference equation:
N

k 0

a k y[n k ] bk x[n k ]
k 0

Applying z-transform, using linearity and shifting


properties, we obtain
N

k 0

k 0

ak z

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

a k z k Y ( z )

k 0

bk z k X ( z )

Digital Signal Processing

A.S.Kayhan

Then, the transfer function (or system function) is


M
bk z k
Y (z)
H (z)
k N 0
X (z)

a k z k
k 0

We can write the transfer function in terms of its


poles, dk, and zeros, ck, as M
H (z)

bo
ao

(1 c k z 1 )

(1 d k z 1 )

k 1
N

k 1

Digital Signal Processing

A.S.Kayhan

Example: Consider system function


(1 z 1 ) 2

H (z)

1 1
3 1
z )( 1
z )
2
4
1 2 z 1 z 2
Y (z)
H (z)

1 1
3 2
X (z)
1
z
z
4
8
(1

then

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

1 1
3 2
z
z )Y ( z )
4
8

x[ n ] 2 x[ n 1] x[ n 2 ]
1
3
y[n ]
y [ n 1]
y[n 2]
4
8
Digital Signal Processing

A.S.Kayhan

Stability and Causality:


A system is causal if ROC for the transfer function H(z) is
outward.
A sytem is stable if ROC for the transfer function H(z)
includes the unit circle.

Digital Signal Processing

A.S.Kayhan

Inverse Systems :
Let H i ( z ) be the inverse system of H ( z ), then
G (z) H i(z)H (z) 1

Eq.(1)

g n h i n * h n n

then

H i(z)

1
,
H (z)

H i (e

1
H (e

Not all systems have an inverse. Ideal LPF does not have
an inverse, we can not recover high frequency components.
M
Now, consider
1
b
H (z) o
ao

(1 c k z

(1 d k z 1 )

k 1
N

k 1

Digital Signal Processing

A.S.Kayhan

Then the inverse system has


N

H i(z)

ao
bo

(1 d k z 1 )

(1 c k z 1 )

k 1
M

k 1

Poles become zeros of the inverse system, zeros become


poles.
For Eq.(1) to hold, ROC of H i ( z ) and H ( z ) must
overlap. If H ( z ) is causal, ROC is
z max

dk

Some part of ROC of H i ( z ) must overlap with this.


Digital Signal Processing

A.S.Kayhan

Example: Suppose
z 1 0 .5
H (z)
,
1 0 .9 z 1

z 0 .9

The inverse system is


1 0 .9 z 1
2 1 .8 z 1
H i(z)

z 1 0 .5
1 2 z 1

Two possible ROC:


z 2

h i1 n 2 n 1 u n 1 1 . 8 2 n 1 u n

which is stable but noncausal.


z 2

h i 2 n 2 n 1 u n 1 . 8 2 n 1 u n 1

unstable but causal.


Digital Signal Processing

A.S.Kayhan

Example: Suppose
1 0 .5 z 1
,
1 0 . 9 z 1

H (z)

z 0 .9

The inverse system is


H i(z)

1 0 .9 z 1
1 0 .5 z 1

The only choice for ROC is overlaps with z 0 . 9 is


z 0 .5

then
h i n 0 . 5 u n 0 . 9
n

0 . 5 n 1 u n

which is both stable and causal.


Digital Signal Processing

A.S.Kayhan

Impulse Response for Rational System:


Assume that a stable LTI Msystem has a rational transfer
function.
(1 c k z 1 )
bo
ao

H (z)

k 1
N

(1 d k z 1 )

k 1

M N

B r z r

H (z)

r0
0 if M N

then

h n

M N

k 1

B r n r

r0

Ak
1 d k z 1
A k d kn u n 1

k 1

Impulse response is of infinite length, called Infinite


Impulse Response (IIR) system.
Digital Signal Processing

A.S.Kayhan

If the system has no poles, then


M

H (z)

bk z k

k 0

h n

b k n k

k 1

Impulse response is of finite length, called Finite Impulse


Response (FIR) system.
Example: Consider a causal system with
y [ n ] ay [ n 1 ] x [ n ]
If a 1 then stable and the impulse

response is

h n a n u n .
Digital Signal Processing

A.S.Kayhan

10

Example: Consider

a n , 0 n M
h n
.
0
,
otherwise

Then
M
1 a M 1 z M 1
H ( z ) a n z n
1 az 1
n0

Zeros at

z k ae

2k
M 1

k 0 ,1 , , M .

Difference equation is
y n

a k x n k

k 1

However, we can also write


y [ n ] ay [ n 1 ] x [ n ] a

M 1

x n M 1

Digital Signal Processing

A.S.Kayhan

Frequency Response for Rational System Functions:


Assume that a stable LTI system has a rational transfer
function. Then frequency response is obtained by
evaluating it on the unit circle:
H (e

M
b k e j k
) k N 0

a k e j k
k 0

H (e

b
) o
ao

(1 c k e

(1 d k e

k 1
N

k 1

Digital Signal Processing

A.S.Kayhan

11

The magnitude response of the system is


M

H (e

bo
ao

1 cke

1 d ke

k 1
N

k 1

The magnitude-squared response of the system is


H (e

H (e

)H

(e

H (e

b
o
ao

1 c

1 c

*
k

d ke

1 d

*
k

k 1
N

e
e

k 1

Digital Signal Processing

A.S.Kayhan

Log magnitude or Gain in decibels(dB) :


20 log

10

H (e

) 20 log

10

bo

ao

20 log

10

1 cke

k 1

20 log

10

1 dke

k 1

Note that :

20 log

10

Y (e

) 20 log
20 log

10
10

H (e
X (e

j
j

Attenuation in dB = - Gain in dB
Digital Signal Processing

A.S.Kayhan

12

Phase response for rational system function:


H (e

b
) o
ao

1 cke

k 1
N

1 d ke

k 1

Group delay for rational system function:

grd H ( e

k 1

d
d
N

k 1

arg[
d
d

1 cke

arg[

1 d ke

Digital Signal Processing

A.S.Kayhan

Frequency Response of A single Zero:


Consider transfer function of a system as
1

H ( z ) 1 az

then with a re
H (e

) H (e

)e

j H ( e

1 re

then magnitude is
H (e

1 r

2 r cos( )

and magnitude in dB is
20 Log

10

H (e

) 20 Log

10

[1 r

Digital Signal Processing

2 r cos( )]

A.S.Kayhan

13

then phase is
H (e

) tan

r sin( )

1 r cos( )

group delay is derivative of the (unwrapped) phase


function
grd [ H ( e

d ( H (e
)]
d

))

Example: Consider two cases : r=0.9, =0 and r=0.9, =:

Digital Signal Processing

A.S.Kayhan

Digital Signal Processing

A.S.Kayhan

14

magnitudes of
vectors give the
magnitude response
H (z)

z a
z

H (e

ze

re
e j

v3
v1

Digital Signal Processing

v3

A.S.Kayhan

phases of vectors give the phase response


H (e

e j re j

)
e j

v 3 v1 3 1 3

Digital Signal Processing

A.S.Kayhan

15

Example: Consider a second order system with


H (z)

1 re

1
j

e j z 1
z 1 1 re j z 1

H (e

v3
v1 v 2

Digital Signal Processing

H (e

A.S.Kayhan

) H (z)

ze

Digital Signal Processing

A.S.Kayhan

16

Example: Consider a third order system with

0 . 05634 1 z 1 1 1 . 0166 z 1 z 2
H (z)
1 0 . 683 z 1 1 1 . 4461 z 1 0 . 7957 z 2

Digital Signal Processing

A.S.Kayhan

Relation Between Magnitude and Phase:


In general, knowledge about magnitude does not provide
information about phase, and vice versa.
But, for rational system functions, with some additional
information such as number of poles and zeros, magnitude
and phase responses provide information about each other.
2
Consider
j
j
*
j
H (e

H (e

)H

H (z)H

with

(e

(1 / z * ) | z e j

H (z)

bo
ao

(1 c k z 1 )

(1 d k z 1 )

k 1
N

k 1

Digital Signal Processing

A.S.Kayhan

17

(1 / z * )

bo
ao

(1 c k* z )

(1 d k* z )

k 1
N

k 1

Then

b
C ( z ) H ( z ) H * (1 / z * ) o
ao

(1 c k z 1 )( 1 c k* z )

(1 d k z 1 )( 1 d k* z )

k 1
N

k 1

Notice that poles and zeros of C(z) occur in conjugate


reciprocal pairs. If one pole/zero is inside the unit circle
there is another outside.
Digital Signal Processing

A.S.Kayhan

If H(z) is causal and stable, then all poles must be inside the
unit circle, with this we can identify the poles. But zeros of
H(z) can not be uniquely identified from zeros of C(z) with
this constraint alone.
Example: Consider two stable systems with
H 1(z)

2 1 z 1 1 0 .5 z 1
1 0 . 8 e j / 4 z 1 1 0 . 8 e j

/4

z 1

j / 4

z 1

and
H 2(z)

1 0 . 8 e

z 1 1 2 z 1
/4
z 1 1 0 . 8 e

Digital Signal Processing

A.S.Kayhan

18

Pole/zero plots are

Digital Signal Processing

A.S.Kayhan

C 1 ( z ) H 1 ( z ) H 1* (1 / z * )

2 1 z 1 1 0 . 5 z 1 2 1 z 1 0 . 5 z

1 0 .8 e j / 4 z 1 1 0 . 8 e j / 4 z 1 1 0 . 8 e j / 4 z 1 0 . 8 e j / 4 z

C 2 ( z ) H 2 ( z ) H 2* (1 / z * )

1 z 1 2 z 1 z 1 2 z
1 0 . 8 e z 1 0 . 8 e z 1 0 . 8 e
1

1 0 .8 e

j / 4

z 1

j / 4

j / 4

j / 4

Observe that (with 4 2 z 2 z 1 )

4 1 0 . 5 z 1 1 0 . 5 z 1 2 z 1 1 2 z

then
C1(z) C 2 (z)
Digital Signal Processing

A.S.Kayhan

19

Example: Consider pole/zero plot of C(z) for a system,


determine H(z).
For a causal
and stable
system, poles
of H(z) are: p1,
p2,p3.
For real ak, bk,
zeros/poles
occur in
complex
conjugate pairs.
Digital Signal Processing

A.S.Kayhan

All-Pass Systems:
Consider following stable system function

ap

then

(e

ap

z 1 a *
H ap ( z )
1 az 1
j *
e j a *
)
j ( 1 ae
)
e
j
j
1 ae
1 ae

(e

) 1

, but H

ap

(e

) constant

This is called an all-pass system .


A general all-pass system has the following form
M

ap

(z) A

k 1

z 1 d k
1 d k z 1

k 1

( z 1 e k* )( z 1 e k )
(1 e k z 1 )( 1 e k* z 1 )

Digital Signal Processing

A.S.Kayhan

20

Example: Consider pole/zero plot of a typical all-pass


system

Digital Signal Processing

A.S.Kayhan

Example: First order all-pass system with a real pole:


z=0.9 (z=-0.9)

Digital Signal Processing

A.S.Kayhan

21

Example: Second order all-pass system with poles:


z 0 .9 e

Digital Signal Processing

j / 4

A.S.Kayhan

Notice that group delay for causal all-pass systems are


positive (unwrapped/continuous phase is nonpositive).
All-pass systems may be used as phase compensators.
They are also useful in transforming lowpass filters into
other frequency-selective forms.

Digital Signal Processing

A.S.Kayhan

22

Block-Diagram Representation:
LTI systems with difference equation represetation
(rational system function) may be imlemented by
converting to an algorithm or structure that can be realized
in desired technology. These structures consists of basic
operations of addition, multiplication by a constant and
delay.In block diagram representation:

Digital Signal Processing

A.S.Kayhan

Example: Consider the second order system :


y [ n ] a 1 y [ n 1] a 2 y [ n 2 ] b o x [ n ]

with
H (z)

bo
1 a1 z a 2 z 2
1

Block diagram representation is

Digital Signal Processing

A.S.Kayhan

23

For a system with higher order difference equation


N

y[n ]

a k y[n k ] bk x[n k ]

k 1

k 0
M

with system function

H (z)

k 0
N

k 1

ak z k

k 1

Rewriting the equation


as
N
y[n ]

bk z k

a k y[ n k ] bk x[ n k ]
k0

a k y[n k ] v[ n ]

k 1
M

where

v[ n ]

bk x[n k ]

k 0

Digital Signal Processing

A.S.Kayhan

Digital Signal Processing

A.S.Kayhan

Direct Form I:

N+M
Delay
element

24

Previous diagram is implementation of

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

1
N
k 1

or

V (z) H 1(z)X (z)

ak z k

k 0

Y ( z ) H 2 ( z )V ( z )

k 0

bk z k

bk z k X ( z )

1
N

ak z k

k 1

V ( z )

Digital Signal Processing

A.S.Kayhan

We can rearrange the system function

W (z) H 2(z)X (z)

Y ( z ) H 1 ( z )W ( z )

In the time domain

k 0

1
N

ak z k

k 1

X (z)

b k z k W ( z )

w[n ]

a k w [n k ] x[ n ]

bk w[n k ]

k 1
M

y[n ]

k0

Digital Signal Processing

A.S.Kayhan

25

M=N

Digital Signal Processing

A.S.Kayhan

Digital Signal Processing

A.S.Kayhan

Direct Form II:

Max(N,M)
Delay elements

26

Example:Consider the system with


1 2 z 1
H (z)
1 1 .5 z 1 0 .9 z 2

Digital Signal Processing

A.S.Kayhan

Flow Graph Representation:


Similar to the block diagram representation:

Digital Signal Processing

A.S.Kayhan

27

Example:Consider the system with

W1(z) W 4 (z) X (z)

W 2 (z) W1(z)

W 3(z) W 2(z) X (z)

W 4 ( z ) z 1W 3 ( z )

Y (z) W 2(z) W 4(z)

Digital Signal Processing

z 1
Y ( z )
1
1z

A.S.Kayhan

X ( z )

z 1
H ( z )
1
1z

Digital Signal Processing

A.S.Kayhan

28

Structures for IIR Systems:


Some considerations:
Computaional complexity(no. of multiplication, delay )
Finite precision, Ease of implementation, etc.

Direct Forms:
We have already seen direct forms.

Cascade Form:
We factor numerator and denominator polynomials of H(z)
M

H (z) A

(1 f k z 1 ) (1 g k z 1 )( 1 g k* z 1 )

(1 c k z 1 ) (1 d k z 1 )( 1 d k* z 1 )

k 1
N1
k 1

k 1
N2

k 1

Digital Signal Processing

A.S.Kayhan

We have cascade of first or second order subsystems


N

H (z)

H k (z)

k 1

k 1

bo
k 1

b ok b 1 k z 1 b 2 k z 2
1 a 1 k z 1 a 2 k z 2
~

1 b 1 k z 1 b 2 k z 2
1 a 1k z 1 a 2 k z 2

Digital Signal Processing

A.S.Kayhan

29

Example:Consider the system with


1 2 z 1 z 2
1 0 . 75 z 1 0 . 125 z 2
1 z 1 1 z 1

1 0 . 5 z 1 1 0 . 25 z 1

H (z)

Digital Signal Processing

A.S.Kayhan

Parallel Form:
H(z) may be written as sum of subsystems
N

H (z)

Ckz

k0

k 0
N

H (z)

Nc
Ak
B k (1 e k z 1 )

1 c k z k k 0 (1 d k z 1 )( 1 d k* z 1 )
N

k0

Ckz

k 0

e ok e 1 k z 1
1 a1 k z 1 a 2 k z 2

Digital Signal Processing

A.S.Kayhan

30

Digital Signal Processing

A.S.Kayhan

Example:Consider the system with

1 2 z 1 z 2
18
25
H (z)
8

1
2
1
1 0.75 z 0.125 z
1 0 .5 z
1 0.25 z 1

Digital Signal Processing

A.S.Kayhan

31

Transposed Forms :
Reverse the directions of all branches while keeping the
values as they were and reverse roles of input and output.
Transposed forms may be useful in finite precision
implementation.
Example:Consider the second order system with

Digital Signal Processing

A.S.Kayhan

Structures for FIR Systems:


Consider an FIR system with following input-output
M
relation
y[n ]

bk x[ n k ]

k0

Observe that the impulse response of this system is


b , 0 n M
h[ n ] n
0 , otherwise

Direct form (or tapped delay line or transversal filter) :

Digital Signal Processing

A.S.Kayhan

32

Transposed direct form structure:

Digital Signal Processing

A.S.Kayhan

Cascade form:
N

H (z)

k 1

H k (z)

( b ok b 1 k z 1 b 2 k z 2 )

k 1

Digital Signal Processing

A.S.Kayhan

33

Linear-Phase FIR Systems:


Finite impulse response (FIR) systems with linear-phase
have symmetry properties such as
h [ n ] h [ M n ], 0 n M

or
h [ n ] h [ M n ], 0 n M

For M even and odd.


Thus there are four types of linear phase FIR filters.

Digital Signal Processing

A.S.Kayhan

Example: Consider
1, 0 n 4
h[ n ]
0 , otherwise
sin( 5 / 2 )
H ( e j ) e j 2
sin( / 2 )

Digital Signal Processing

A.S.Kayhan

34

Example: Consider
h [ n ] [ n ] 2 [ n 1] [ n 2 ]

H (e

) 1 2e

j 1

j 1

j 1

j 1

2 e

e
j 1

j 2

2 [1 cos( )].

Digital Signal Processing

A.S.Kayhan

Assume M is even
M

y[n ]

h [ k ]x [ n k ]

k 0

M / 2 1

h[ k ] x[ n k ] h[ M / 2 ] x[ n M / 2 ]

k0
M

h[k ] x[n k ]

k M / 2 1

With, in the last term, k=M-l, l=0M/2-1


M / 2 1

y[n ]

h[ k ] x[ n k ] h[ M / 2 ] x[ n M / 2 ]

k 0
M / 2 1

h[ M l ] x[ n M l ]

l0

Digital Signal Processing

A.S.Kayhan

35

If

h[ n ] h[ M n ]
M / 2 1

y[n ]

h [ k ]( x [ n k ] x [ n M k ])

k 0

h[ M / 2 ]x[ n M / 2 ]

If

h[ n ] h[ M n ]
M / 2 1

y[n ]

h [ k ]( x [ n k ] x [ n M k ])

k 0

Digital Signal Processing

A.S.Kayhan

Finite-Precision Numerical Effects:


Input Quantization:
We have seen earlier that continuous-time signals are
sampled, quantized and coded first

Digital Signal Processing

A.S.Kayhan

36

Example:

Digital Signal Processing

A.S.Kayhan

In twos complement binary system leftmost bit is the sign


bit. If we have (B+1)-bit twos complement fraction of the
following form
a 0 a1a 2 a B

Value is

a 0 2 0 a1 2 1 a 2 2 2 a B 2 B

Example:

Binary Code

Numeric value

0 11

3/4

1 10

1/2

1 01

1/4

Digital Signal Processing

A.S.Kayhan

37

Quantizer step size is


With
where

2X m
2 B 1

x[ n ] X

x B [n ]

1 x B[n] 1

(two' s complement

Analysis of Quantization Errors:


We observe that the quantized samples are in general
different from the true values. The difference is the
quantization error
^
e [ n ] x [ n ] x [ n ].

and

/ 2 e[ n ] / 2
Digital Signal Processing

A.S.Kayhan

A simplified model of quantizer is

Assumptions about e[n]:


e[n] is stationary
e[n] is uncorrelated with x[n]
e[n] is white noise
e[n] is uniformly distributed
Digital Signal Processing

A.S.Kayhan

38

Example:
Sinusoidal
signal
3bit
quantizer
Error for
3bit

Error for
8bit
Digital Signal Processing

A.S.Kayhan

Mean value of e[n] is zero


/2

1
de 0

/2

Variance (or power) of e[n] is


/2

2
e

/2

1
2
de

12

For (B+1)-bit quantizer with full-scale value Xm

2
e

2 2 B X

2
m

12

Digital Signal Processing

A.S.Kayhan

39

Signal-to-Noise Ratio (SNR) is defined as the ratio of


signal variance (power) to noise variance. Expressed in dB
x2
12 2 2 B x2

SNR 10 log 10 2 10 log 10


X m2
e

6 . 02 B 10 . 8 20 log

10

m
x

If
B B 1,
x x / 2,

SNR SNR 6 dB
SNR SNR - 6dB

Digital Signal Processing

A.S.Kayhan

Coefficient Quantization in IIR Systems:


M

Consider

bk z k

H (z)

k 0
N

ak z k

k 1

If the coefficients are quantized,


we get
M
^

b k z k

H (z)

k 0
N

a k z k

k 1

where

b k bk bk , a

ak ak

Digital Signal Processing

A.S.Kayhan

40

Each pole or zero will be affected by all the errors in the


coefficient quantization.
If the poles (or zeros) are close to each other (clustered),
then quantization of coefficients may cause large shifts
of poles (or zeros).
Direct form structures are more sensitive to coefficient
quantization than the other forms (parallel, cascade,...)

Digital Signal Processing

A.S.Kayhan

Example: Consider a bandpass IIR elliptic filter of order 12


implemented in cascade form of 2nd order subsystems and
direct form.

Digital Signal Processing

A.S.Kayhan

41

Passband
cascade
unquantized

Passband
cascade
16-bit

Digital Signal Processing

A.S.Kayhan

Digital Signal Processing

A.S.Kayhan

Passband
parallel
16-bit

Direct form
16-bit

42

Poles of Quantized 2nd order subsystems :


Because of robustness, parallel and cascade forms are used
more than direct forms.
We can further improve the robustness, by improving
implementation of the 2nd order subsystems.
Consider the following implementation in direct form:

Digital Signal Processing

A.S.Kayhan

When coefficients are quantized, a finite number of pole


possitions possible.

7bits

4bits
Circles correspond to r2,
vertical lines to 2rcos
Digital Signal Processing

A.S.Kayhan

43

Consider the following coupled form

Digital Signal Processing

4bits

A.S.Kayhan

7bits

Digital Signal Processing

A.S.Kayhan

44

Coefficient Quantization in FIR Systems:


Consider FIR system with transfer function
M

H (z)

h[n ]z n

n0

If

h[ n ] h[ n ] h[n ]

then

H (z)

h[n ]z n H ( z ) H ( z )

n0

where
and

H (z)

h[n ]z n

n0
^

H (e

) H (e

) H (e

Digital Signal Processing

)
A.S.Kayhan

Example: Consider FIR filter of order 27

Digital Signal Processing

A.S.Kayhan

45

Digital Signal Processing

A.S.Kayhan

Effects of Round-off Noise:


Analysis of Direct Form IIR Structures:
Consider Nth-order difference equation for Direct Form I
N

y[n ]

k 1

a k y[ n k ] bk x[ n k ]
k0

Assume that all signal values and coefficients are


represented by (B+1)-bit fixed point binary numbers.
Therefore, each multiplication is followed by a quantizer,
then
^

y[n ]

k 1

M
^

Q a k y [ n k ] Q b k x [ n k ]

k 0

Digital Signal Processing

A.S.Kayhan

46

Digital Signal Processing

A.S.Kayhan

An alternative representation is as following

Digital Signal Processing

A.S.Kayhan

47

Rounding or truncation of a product bx[n] is represented by


a noise source of the form
e [ n ] Q bx [ n ] bx [ n ]

Assumptions about e[n]s:


Each e[n] is stationary
Each e[n] is uncorrelated with x[n] and other e[n]s
Each e[n] is uniformly distributed
For (B+1)-bit rounding
2 B / 2 e[ n ] 2 B / 2

Digital Signal Processing

A.S.Kayhan

For (B+1)-bit truncation


2 B e[ n ] 0

Mean and variance for rounding are

e 0

2 2 B

12

2
e

Mean and variance for truncation are


e

2B
2

2
e

2 2 B
12

Digital Signal Processing

A.S.Kayhan

48

Now, lets try to determine effect of quantization noise on


the output of the system. We can redraw the system as

e[ n ] e 0 [ n ] e1[ n ] e 2 [ n ] e 3 [ n ] e 4 [ n ]
Digital Signal Processing

A.S.Kayhan

Since all the noise sources are


2
e

2
e0

2
e1

2
e2

2
e3

2
e4

5
For the general Direct Form I case
2 2 B
2
e M 1 N
12
Now, we observe that

2
e0

2 2 B
5
12

f [n ]

a k f [ n k ] e[ n ]

k 1

For rounding mean of the output noise is zero.


The variance for rounding or truncation is

2
f

2 2 B
M 1 N
12

h ef [ n ] is impulse response for

h ef [ n ]

ef

(z) 1 / A(z)

Digital Signal Processing

A.S.Kayhan

49

Example: Consider the following system


H (z)

b
1 az

a 1.

h ef [ n ] a n u [ n ]

Then the noise variance(power) at


the output is

2
f

2 2 B
2
12

2n

2 2 B
2
12

1 a

Digital Signal Processing

A.S.Kayhan

Analysis of Direct Form FIR systems:


Consider

y[n ]

h[ k ]x[ n k ]

k 0

f [ n ] e[ n ]

k 0

e k [ n ],

2
f

2 2 B
M 1
12

Digital Signal Processing

A.S.Kayhan

50

End of Part 2

Digital Signal Processing

A.S.Kayhan

51

DIGITAL
SIGNAL
PROCESSING
Part 3
Digital Signal Processing

A.S.Kayhan

IIR Filters:
Infinite impulse response (IIR) filters have rational transfer
M
functions as
k
H (z)

bk z

ak z k

k 0
N

k 0

Some IIR filter types are: Butterworth, Chebyshev,


Elliptical.
IIR filters have to be stable.
IIR filters may not have linear-phase.

Digital Signal Processing

A.S.Kayhan

Filter Specifications (Low-pass):

20 log

10

( )

Design analog filter transform to Digital filter

Digital Signal Processing

A.S.Kayhan

Analog Butterworth Filters:


Approximate ideal LPF with magnitude-squared response
H ( )

K ,

0,

c
c

by the following rational function:


H ( )

K 1 a 1 2 a n 1 2 n 2
,
1 b1 2 b n 2 n

bn 0

|H()|2 must be even function of , and denominator


degree must be higher than degree of numerator (lowpass).
Digital Signal Processing

A.S.Kayhan

For maximal flatness at the origin, =0, The first 2n-1


derivatives of |H()|2 must be zero. This requires
i 1, 2 , , n 1 .

a i bi ,
H ( )

K 1 b1 2 b n 1 2 n 2

,
1 b1 2 b n 2 n

bn 0

Maximal flatness also at , =, requires


i 1,2 , , n 1 .

a i bi 0,

Then, we have
2

H ( )

K
1 bn

2n

Digital Signal Processing

A.S.Kayhan

Let |H(=0)|2 = 1. Then


H ( )

1
1 bn

2n

At the half-power frequency


H ( )

1
1

2
1 bn

2n
o

bn

2n

Then, we have the Butterworth response


H ( )

1

1
o

Digital Signal Processing

2n

A.S.Kayhan

Consider the filter specifications:


20 log
10 log

10

/ 10

10

10

H ( ) dB .

2n

2n

dB .

To find n:
Using max and p
10

max

/ 10

10

/ 10

1/ 2n

Using min and s

p
o

2n

10

min

/ 10

Digital Signal Processing

s
o

2n

A.S.Kayhan

Dividing these equations

10
10

min

max

/ 10
/ 10


1


1

s
p

2n

Taking logarithm, we get the filter order as:

10 min / 10 1
log
10 max / 10 1

2 log s
p

Digital Signal Processing

A.S.Kayhan

We can normalize the frequency so that o = 1. Then


2

H ( )

1
1

2n

To find the filter poles, we let =s/j,


H (s) H ( s)

1
1

2n
1 (s / j)
1 ( 1) n s 2 n

then, set the denominator to zero


1 ( 1) n s 2 n 0

( 1) n s 2 n 1

If n is even, then
s 2n 1 e
sk e

1 2 k
j (
)
2n

j ( 2 k )

, k 0 ,1 ,..., 2 n 1 .

, k 0 ,1 ,..., 2 n 1 .
Digital Signal Processing

A.S.Kayhan

If n is odd, then
s 2n 1 e
sk e

k
n

j 2k

, k 0 ,1 ,..., 2 n 1 .

, k 0 ,1 ,..., 2 n 1 .

Note that all the poles lie on a circle with radius 1, because
the frequency is normalized. (If we want to design analog
filter we need to correct this).
Also, choose the poles in the left-half plane to get a stable
filter.

Digital Signal Processing

A.S.Kayhan

Example: Design specs. for a Butterworth LP filter:


At f = 2000 Hz, max= 3dB
At f = 3000 Hz, min= 10dB
Then, the filter order n is
n 2.7154 n = 3.
Poles are at
sk e

k
3

, k 0 ,1 ,..., 5 .

1
( s 1 )( s 2 s 1 )
1

.
1
3
1
3
( s 1 )( s ( j
))( s ( j
))
2
2
2
2
H (s)

Digital Signal Processing

A.S.Kayhan

Analog Chebyshev Filters:


We can generalize Butterworth response as:
H ( )

1
1

.
n
1 F n ( ) 2
1 ( ) 2

Fn() is a function of . Now, consider:


x cos( ) cos 1 ( x )
y n cos( n ) cos( n cos

( x ))

This is the Chebyshev polynomial of order n. When


x 1 , C n ( x ) cosh( n cosh

( x ))

When x 1 , Cn(x) 0.
Digital Signal Processing

A.S.Kayhan

Cn(x) has zeros in -1< x < 1 :


C1(x)

C2(x)

C3(x)

C4(x)

C5(x)

-1
-1

0
x

-1
1 -1

n 1

0
x

-1
-1

0
x

-1
1 -1

(x) 2 x C n (x) C

-1
1 -1

0
x

n 1

0
x

( x ),

C o ( x ) 1, C 1 ( x ) x .

Digital Signal Processing

A.S.Kayhan

Use Cn(.) in :
H ( )

1
1 2 C n2 ( )

1 , C n ( ) cosh( n cosh
1 , C n ( ) cos( n cos

2 1 ,

( ))

( ))

is known as the ripple factor.

Digital Signal Processing

A.S.Kayhan

Behaviour at =0:
C n2 ( ) 0 , H ( 0 )
C n2 ( ) 1 , H ( 0 )

1,

if n is odd

1
,
(1 2 )

if n is even

Behaviour at =1:
C n2 ( ) 1 ,

for all n

H ( 1)

1
(1 2 )

Digital Signal Processing

A.S.Kayhan

The attenuation is

10 log 1 2 C n2 ( )

10

max/ 10

When 2 C n2 ( ) 1 3 . 01 dB .
This defines the half-power frequency (3dB cut-off) hp.
Then,

1
cosh( n cosh

1
1
cosh 1 ( hp )
cosh 1 ( )
n

1
1
hp cosh(
cosh 1 ( )).
n

C n (

hp

Digital Signal Processing

hp

))

hp

1 ).
A.S.Kayhan

The specifications for a Chebyshev filter are max, min, s


(p=1). Bandpass is between 0 1 rad/s.
To find n:

min 10 log 1 2 C n2 ( s )

10 min
With

cosh( n cosh

Finally,
cosh
n

/ 10

10
1

1 2 C n2 ( s )

max/ 10

( s ))

10

/ 10

min

cosh

10
10
1
10

min

/ 10

max

/ 10

max

1
1
/ 10

( s )

Digital Signal Processing

A.S.Kayhan

To find the filter poles, we let =s/j,


H (s) H ( s)

then

1
1 C n2 ( s / j )
2

1 2 C n2 ( s / j ) 0 C n ( s / j ) j

Let
With
cos( x )

cos( w ) cos( u jv ) s / j
cos 1 ( s / j ) w
e

jx

e
2

jx

, cos( jx )

C n ( s / j ) cos( n cos

ex ex
cosh( x )
2

( s / j )) cos( nw )

C n ( s / j ) cos( nu ) cosh( nv ) j sin( nu ) sinh( nv )


Digital Signal Processing

A.S.Kayhan

With

cos( nu ) cosh( nv ) 0

C n (s / j) j

then

sin( nu ) sinh( nv )

cosh(nv) can never be zero, therefore cos(nu) must be


zero. It is possible for

3 5
,
,
,
2n 2n 2n

( 2 k 1 ), k 0 ,1 , , 2 n 1 .
2n

uk
uk

Digital Signal Processing

A.S.Kayhan

For these values of u, sin(nu) = 1, then


vk

Remember that
then

1
sinh
n

cos

1
) a.

( s / j ) w u jv


2 k 1 ja
s k j cos( w k ) j cos
2n

The poles are :


s k k j k , k 0 ,1 , , 2 n 1

2k 1
) sinh( a )
2n
2k 1
cos(
) cosh( a )
2n

sin(

Digital Signal Processing

Choose left
half poles.
A.S.Kayhan

10

Discrete Time Filter Design(IIR):


There are 3 approches:
1-Sampling (Impulse invariance)
2-Bilinear transformation
3-Optimal procedures

Impulse invariance method:


We can sample the impulse response hc(t) of an analog filter
with desired specifications as (Td is sampling interval):
then

h [ n ] T d h c nT

H ( )

H c(

k ).
Td
Td

Digital Signal Processing

If
then

A.S.Kayhan

/ Td

H c ( ) 0 ,

),
.
Td
Analog and digital frequencies have a linear relation:
Td .
H ( ) H c (

Consider the transfer function of a system expressed as


N

H c (s)

k 1

Ak
,
s sk

Then, the impulse response is


N

hc (t )

Ak e skt ,

t 0.

k 1

Digital Signal Processing

A.S.Kayhan

11

The impulse response of the discrete time filter is


h n T d h c ( nT

N
d

T d A k e s k nT d u n

k 1

h n

T d ( A k e s k T d ) n u n .

k 1

Transfer (or system) function of the discrete time filter is


N

H (z)

k 1

Poles are

Td Ak
.
1 e sk T d z 1

s s k z e skTd .

If Hc(s) is stable (k < 0), then H(z) is also stable (|z| < 1).
Digital Signal Processing

A.S.Kayhan

Example: Transfer function of analog filter is


1
( s 1 )( s 2 s 1 )
1
1
1
1
j
j
1
2
2
12
12

.
s 1
1
3
1
3
s ( j
)
s ( j
)
2
2
2
2
H c (s)

then

Td

1 z 1e Td
1
1
1
Td ( j
)
Td ( j
2
2
12

H (z)

1 z 1 e

Td (

1
3
j
)
2
2

1 z 1e

Digital Signal Processing

Td (

1
)
12
.
1
3
2

A.S.Kayhan

12

Bilinear Transformation:
Transformation needed to convert an analog filter to a
discrete time filter must have following properties:
1- j axis of the s-plane must be mapped onto the unit
circle of the z-plane,
2- stable analog filters must be tranformed into stable
discrete time filters (left hand plane of the s-plane must be
mapped into inside the unit circle of the z-plane).
Following BT satisfies these conditions:
1 z 1
s K
1 z 1

1 s / K
.
1 s / K

Digital Signal Processing

Let

s j ,

z re

A.S.Kayhan

then
r

(1 / K ) 2 ( / K ) 2

.
(1 / K ) 2 ( / K ) 2

Therefore
0

( LH plane ) r 1 ( inside

( j axis ) r 1 ( the u.c. )

( RH plane ) r 1 ( outside
Digital Signal Processing

the u.c. )

the u.c. )
A.S.Kayhan

13

Digital Signal Processing

Now, let
then

s j ,

z e

1 e j
e j / 2 ( e j / 2 e
j K
K j / 2
1 e j
e
( e j / 2 e
sin( / 2 )
j Kj
jK tan( / 2 ).
cos( / 2 )

or

A.S.Kayhan

j / 2
j / 2

)
.
)

K tan( / 2 ).

Digital Signal Processing

A.S.Kayhan

14

Observations:
1- According to Taylor series expansion of tan(), for small
K / 2 3 / 24 K / 2 .
2- For high frequencies, the relation is nonlinear causing a
distortion called warping effect. Therefore, BT is usually used
for the design of LPF to avoid this.

Digital Signal Processing

A.S.Kayhan

Discrete Butterworth Filter Design:


We convert a frequency normalized analog Butterworth filter
to a discrete filter using the BT.
Normalized half power frequecy HP=1 is mapped into the
discrete half power frequency HP. To do that, we set K to
K b ( HP 1) / tan(HP / 2) cot( HP / 2).

Digital Signal Processing

A.S.Kayhan

15

Then, we use

K b tan(0.5 ) tan(0.5 ) / tan(0.5HP ).

in
H

( )

1
1

2n

And get the discrete Butterworth Low Pass Filter as:


H

( )

tan( 0 . 5 )
1

tan( 0 . 5 HP )

2n

Using the design specifications, we find the filter order as

min / 10

1
log 10
max / 10

10

2 log tan( 0 . 5 s )
tan( 0 . 5 p )

Digital Signal Processing

A.S.Kayhan

The half-power freq. is

HP

2 tan

tan( 0 . 5

10

max

/ 10

1/ 2n

K b cot(0.5 HP ).

Example: Consider the second order analog filter


H

(s)

1
(s2

2 s 1)

Applying the BT, we get (Kb = 1)


( z 1) 2
H 2(z)
0 . 2929
( z 2 0 . 1716 )
Digital Signal Processing

A.S.Kayhan

16

Remarks:
1- Given the specs.:
a) find the filter order n
b) obtain the analog filter H(s)(using LHP poles)
c) calculate HP and Kb
d) use biliear transformation to find H(z).
2- H(z) is BIBO stable, because H(s) is stable.
3- Applying the BT to high order filters may be tedious.
Therefore, first express H(s) as product or some of first
and second order functions, then apply the BT.

Digital Signal Processing

A.S.Kayhan

Example: Design specs. for a LP digital Butterworth filter:


At f = 0 Hz, 1= 18dB
At f = 2250 Hz, 2= 21dB
At f = 2500 Hz, 3= 27dB
Sampling freq. fsmp= 9000 Hz
(ej0)= 18dB
fp
max = 2 1=3dB
fs
p 2
, s 2
min = 3 1=9dB
f smp
f smp
Filter order n 5.52,n = 6, Kb = 1 and a gain G for = 18dB
H 6(z)

(z2

0 . 0037 ( z 1 ) 6
0 . 59 )( z 2 0 . 17 )( z 2 0 . 0 . 02 )
Digital Signal Processing

A.S.Kayhan

17

Discrete Chebyshev Filter Design:


We find the constant K by transforming (normalized
passband freq.) P=1 into the discrete passband frequency
P. We get
K c 1 / tan(0.5P ) tan(0.5 ) / tan(0.5 P )

And get the discrete Chebyshev Low Pass Filter as:


H ( )

1 C

2
n

1
(tan( 0 . 5 ) / tan( 0 . 5

))

Digital Signal Processing

Using C1(1)=1, we let p ,

max 10 log 1
10 min

Also using s ,
We find the filter order

10

max

min

10

1
cosh 1 [tan( 0 . 5 s ) / tan( 0 . 5 p )]

cosh

/ 10

A.S.Kayhan

min

/ 10

Digital Signal Processing

max

/ 10

A.S.Kayhan

18

Example: Design specs. for a LP digital Chebyshev filter:


At f = 0 Hz, 1= 0dB
At f = 2250 Hz, max= 3dB
At f = 2500 Hz, min= 10dB
Sampling freq. fsmp= 9000 Hz

f smp

Filter order n = 3,
H 3(z)

fs
f smp

Kc = 1

(z2

0 . 09 ( z 1 ) 3
0 . 15 z 0 . 72 )( z 0 . 54 )

Digital Signal Processing

A.S.Kayhan

Example: Design specs. for a LP digital Chebyshev filter:


At = 2/5 rad, max= 1dB
At = /2 rad, min= 9dB
Filter order n = 3
H 3(z)

(z2

0 . 736 ( z 1 ) 3
0 . 505 z 0 . 619 )( z 0 . 472 )

Example: Design specs. for a LP digital Butterworth filter:


At = /2 rad, max= 3dB
= 0 rad, = 0dB
At = 5/9 rad, min= 10dB
Filter order n = 7,
H

(z)

z(z2

Kb = 1

0 . 01656 ( z 1 ) 7
0 . 636 )( z 2 0 . 232 )( z 2 0 . 052 )
Digital Signal Processing

A.S.Kayhan

19

Frequency Transformations:
The objective is to obtain transfer functions of other types of
dicrete filters from already available prototype Low Pass
Filters using tranformation functions g(z) as
H (z) H

LP

( g ( z ))

Example: Design specs. for a LP digital Chebyshev filter:


At f = 0 Hz, = 0dB
At f = 2250 Hz, 2= 21dB
At f = 2500 Hz, 3= 27dB
Sampling freq. fsmp= 9000 Hz
Digital Signal Processing

LPF

(z)

z3

A.S.Kayhan

0 . 09 ( z 1 ) 3
0 . 691 z 2 0 . 802 z 0 . 39

Digital Signal Processing

A.S.Kayhan

20

Now, we want a HPF with cutt-off at 3.6kHz, we use


following transformation
( z 1 0 . 5095 )
1
z

HPF

(z)

z3

(1 0 . 5095 z 1 )
0 . 0066 ( z 3 3 z 2 3 z 1 )
2 . 361 z 2 2 . 102 z 0 . 6884

Digital Signal Processing

A.S.Kayhan

Design of FIR Filters by Windowing:


Ideal frequency response and corresponding impulse
response functions are H ( e j ), h n .
d

Generally hd[n] is infinitely long. To obtain a causal practical


FIR filter, we can truncate it as
,0 n M
h n
h n d
, otherwise.
0

In a general form we can write it as


h n h d n w n

Where w[n] is window function.


Digital Signal Processing

A.S.Kayhan

21

In frequency domain, we have


H (e

1
)
2

(e

)W ( e

)d .

Digital Signal Processing

A.S.Kayhan

Some commonly used window functions are Rectangular,


Bartlett, Hamming, Hanning, Blackman, Kaiser.
Some important factors in choosing windows are:
Main lobe width and Peak side lobe level. For rectangular:

Digital Signal Processing

A.S.Kayhan

22

Main lobe width and transition region; Peak side lobe level
and oscillations of filter are related.

Digital Signal Processing

A.S.Kayhan

Digital Signal Processing

A.S.Kayhan

23

Digital Signal Processing

A.S.Kayhan

Digital Signal Processing

A.S.Kayhan

24

Discrete Time Fourier Series (DTFS):


~

Consider a periodic sequence x n with period N:


~

x n x n N .

Which can be represented by a Fourier series as:


N 1

1
x n
N

X [ k ]e

2
nk
N

k0

The DTFS coefficients are obtained as:


N 1 ~

x n e

X [k ]

2
nk
N

n0

Digital Signal Processing

Let

A.S.Kayhan

2
N

The DTFS analysis and synthesis equations are:


N 1 ~

x n W

X [k ]

nk
N

n0

x n

1
N

N 1

X [k ] W

nk
N

k 0

Example: Consider the periodic impulse train:


~

x n

[ n rN ]

The DTFS
~

X [k ]

N 1

n W

nk
N

for all k .

n0

Digital Signal Processing

A.S.Kayhan

25

Properties:
1- Linearity: It is linear.
2- Shift of a sequence: If

x n X [ k ]

x n m W

then
Similarly,

nl
N

km
N

X [k ]

x n X [ k l ]

3- Periodic convolution: Consider two periodic


sequences with period N
~

x 1 n X 1 [ k ]

x 2 n X 2 [ k ]

Then,
~

X 3[ k ] X 1[ k ] X 2 [k ]

x 3 n

N 1 ~

x 1 [ n m ] x 2 [ m ].

m0

Digital Signal Processing

A.S.Kayhan

Example: Consider periodic convolution of two sequences:

Digital Signal Processing

A.S.Kayhan

26

Sampling the Fourier Transform:


Consider signal x[n] with DTFT X() and assume by
sampling X() , we get
~

X [ k ] X ( ) |

2

k
N

X
k
N

X [ k ] could be the sequence of DTFS coefficients

of a periodic signal which may be obtained as


1
x n
N
~

N 1

X [k ] W

nk
N

k 0

Digital Signal Processing

A.S.Kayhan

Substituting,
X

x m

e j m ,

X k X ( ) | 2

then,

x n x n *

n rN

x n

Digital Signal Processing

rN .

A.S.Kayhan

27

If N is too small, then aliasing occurs in the time domain.

If there is no aliasing, we can recover x[n].

Digital Signal Processing

A.S.Kayhan

Discrete Fourier Tranform (DFT):


DFT is obtained by taking samples of the DTFT.
Remember DTFT is defined as:

X (e

x [ n ]e

j n

We take samples of X(ej) at uniform intervals as:


X [k ] X (e

We define:
W

2
k
N
j

, k 0 ,1 , N 1 .

2
N

Digital Signal Processing

A.S.Kayhan

28

Then the DFT is defined as (analysis equation):


N

X [k ]

x[ n ] W

kn
N

n0

for k=0,1,...,N-1.
The inverse DFT is defined as (synthesis equation):
x[ n ]

1
N

X [k ] W

kn
N

n0

for n=0,1,...,N-1.

Digital Signal Processing

A.S.Kayhan

Digital Signal Processing

A.S.Kayhan

Example:
N=5

29

N=10

Digital Signal Processing

Properties:
1- Linearity: DFT is a linear operation.
2- Circular shift:
x n m

N , 0

n N 1 e

Digital Signal Processing

A.S.Kayhan

2
km
N

X [ k ].

A.S.Kayhan

30

3- Circular convolution:
x 3 n x 1 n

x 2 n

N 1

x 1 [ n m

] x2[m ]

m 0

Example:

Digital Signal Processing

A.S.Kayhan

Digital Signal Processing

A.S.Kayhan

Example:
N=L

31

N=2L

Digital Signal Processing

A.S.Kayhan

4- Multiplication(Modulation):
x 3 n x 1 n x 2 n X

k .

Linear Convolution Using the DFT:


Since there are efficient algorithms to take DFT, like FFT,
we can use it instead of direct convolution as:
1. Compute N point DFTs, X 1 k and X 2 k .
2. Multiply them to get X 3 k X 1 k X 2 k .
3. Compute the inverse DFT, to get:
x 3 n x 1 n

x 2 n

Digital Signal Processing

A.S.Kayhan

32

Linear Convolution of Finite Length Signals:


Consider two sequences x1[n] of length L and x2[n] of
length P, and x3[n] = x1[n]* x2[n].
Observe that x3[n] will be of length (L+P-1).

Circular Convolution as Linear Convolution with


Aliasing :
Consider again x1[n] of length L and x2[n] of length P,
and x3[n] = x1[n]* x2[n].
X 3 (e

) X 1 (e

) X 2 (e

Digital Signal Processing

A.S.Kayhan

Taking N samples
X

k X 2 k .

Now, taking the inverse DFT, we have


x 3 n rN , 0 n N 1
x 3 p n r

0,
otherwise.
x 3 p n x 1 n

x 2 n

This circular convolution is identical to the linear


convolution corresponding to X1(ej) X2(ej),
if N (L+P-1).

Digital Signal Processing

A.S.Kayhan

33

Example:

Digital Signal Processing

A.S.Kayhan

Digital Signal Processing

A.S.Kayhan

Example:

34

Digital Signal Processing

A.S.Kayhan

LTI Systems Using the DFT :


Consider x[n] of length L and h[n] of length P, and y[n] =
x[n]* h[n] will be of length (L+P-1).
To obtain the result of linear convolution using the DFT,
we must use N ( (L+P-1))-point DFTs. For that x[n]
and h[n] must be augmented with zeros (zero-padding).
Overlap-Add Method :
Consider h[n] of length P, and length of x[n] is much
grater than P.
We can write x[n] as combination of length L segments:
x n rL , 0 n L 1
x r n
,
0
,
otherwise

Digital Signal Processing

x n

x r n rL

A.S.Kayhan

35

Since the system is LTI then


y n

y r n rL ,

y r n x r n * h n

Each output segment yr[n] can be obtained using (L+P-1)


point DFT.
Example:

Digital Signal Processing

A.S.Kayhan

Digital Signal Processing

A.S.Kayhan

36

Overlap-Save Method :
Consider again h[n] of length P, and length of x[n] is much
grater than P.
In this method L-point circular convolution (or DFT) is
used. Since the first (P-1) points will be incorrect,
input segments must overlap.
We can write each L sample segment of x[n] as :
x r n x n r ( L P 1 ) ( P 1 ) ,
y n

0 n L 1

y r n r ( L P 1 ) ( P 1 ) ,

y r n y rp n , P 1 n L 1
Digital Signal Processing

A.S.Kayhan

Digital Signal Processing

A.S.Kayhan

Example:

37

Efficient Computation of the DFT :


Remember the definition of the DFT and inverse DFT
N 1

x[ n ]

N 1

X [k ] W

kn
N

X [k ]

n0

x[n ] W

kn
N

n0

N2 comlex multiplications and N(N-1) additions or 4N2 real


mult. and 4N(N-2) real additions necessary:
Re{ x [ n ] } Re{ W Nkn }

kn
Im{ x [ n ] } Im{ W N }

Re{ x [ n ] } Im{ W Nkn }

j Im{ x [ n ] } Re{ W kn }
N

X [k ]

n0

Digital Signal Processing

A.S.Kayhan

To improve the efficiency, we can use some properties as:


1) W
2) W

k(N n)
N
k(N n)
N

W
W

kn
N
kn
N

(W
W

kn
N

)*

(k N )n
N

Example:
Re{ x [ n ] } Re{ W

kn
N

} Re{ x [ N n ] } Re{ W

Re{ x [ n ] } Re{ x [ N n ] } Re{ W

Digital Signal Processing

kn
N

k(N n)
N

}.

A.S.Kayhan

38

Fast Fourier Transform(FFT):


Fast Fourier Transform algorithms are used to implement
DFT efficiently to reduce the number of multiplication
and addition operations.
Two main algorithms are:
Decimation in time and Decimation in frequency. Both
these algorithms require that N=2m.
The number of operations using either of these will
require (N/2)log2N complex multiplications and Nlog2N
additions.
Direct implementation of DFT requires N2 complex
multiplications and additions. For N=1024= 210
N2=1048576
but
Nlog2N=10240.
Digital Signal Processing

A.S.Kayhan

Decimation in time FFT Algorithm:


Assume N=2m
N 1

X [k ]

kn
N

x[n ] W

, k 0 ,1 , , N 1

n0

Which can be written as


X [k ]

x[ n ] W

kn
N

n even

x[n ] W

kn
N

n odd

With n = 2r (even) and n = 2r+1 (odd)


N / 2 1

X [k ]

N / 2 1

x [ 2 r ] (W

2
N

) rk W

k
N

r0

x [ 2 r ] (W

rk

N / 2

r0

G k

2
N

) rk

r0

N / 2 1

x [ 2 r 1 ] (W

N / 2 1

) W

k
N

x[ 2 r 1] W

rk

N / 2

r0

k
N

k .
Digital Signal Processing

A.S.Kayhan

39

X [ k ] G k

k
N

k .

Requires N+2(N/2)2 multiplications


Digital Signal Processing

A.S.Kayhan

Since G[k] and H[k] requires 2(m-1)-point DFTs, each one can
be similarly decomposed until we reach 2-point DFTs.

Digital Signal Processing

A.S.Kayhan

40

Digital Signal Processing

A.S.Kayhan

Digital Signal Processing

A.S.Kayhan

Butterfly:
(in place comp.)

Bit reversed
order

41

Decimation in frequency FFT Algorithm:


Again assume N=2m
N 1

X [k ]

x[n ] W

kn
N

, k 0 ,1 , , N 1

n0

then

N 1

X [2 r ]

x[ n ] W

2 rn
N

r 0 ,1 , , ( N / 2 1 )

n0
N / 2 1

X [2 r ]

N 1

x[ n ] W

2 rn
N

n0

2 rn
N

N / 2 1

x[ n ] W

2 rn
N

n0
N / 2 1

X [2r ]

x[ n ] W

nN /2

N / 2 1

X [2 r ]

x[ n N / 2 ] W

2r(n N /2)
N

n0
N / 2 1

( x [ n ] x [ n N / 2 ]) W

rn
N /2

n0

rn
N /2

n0

Digital Signal Processing

Similarly for

g [n ] W

A.S.Kayhan

0 r ( N / 2 1)
N / 2 1

X [ 2 r 1]

( x [ n ] x [ n N / 2 ]) W

n
N

rn
N /2

n0

N / 2 1

h [ n ] W Nn W

rn
N /2

n0

Digital Signal Processing

A.S.Kayhan

42

Procedure is repeated until 2-point DFTs

Digital Signal Processing

A.S.Kayhan

Computation of Inverse DFT:


x[ n ]

1
N

X [ k ]W

kn
N

, n 0 ,1 , , N 1

n0

X [k ]

x[ n ] W

kn
N

, k 0 ,1 , , N 1

n0

1 N
1
x [n]
X * [ k ]W Nkn
DFT

N n0
N
*
1
x[ n ]
DFT X * [ k ]
N
*

[k ]

Digital Signal Processing

A.S.Kayhan

43

End of Part 3

Digital Signal Processing

A.S.Kayhan

44

DIGITAL
SIGNAL
PROCESSING
Part 4
J.S. Lim, Two Dimensional Signal Processing, in Advanced Topics In Signal Processing, Prentice-Hall.

Digital Signal Processing

A.S.Kayhan

Signals:
Impulses: The 2-D impulse is,

1, n1 n 2 0
n1 , n 2
0, otherwise

Digital Signal Processing

A.S.Kayhan

xn1 , n2 may be represented as a linear


Any sequence
combination of shifted impulses:

xn1 , n2

x[k , k ] [n
1

k1 , n2 k 2 ].

k1 k 2

Digital Signal Processing

A.S.Kayhan

Line impulses are:


1, n1 0
xn1 , n2 T n1
0, otherwise

Digital Signal Processing

A.S.Kayhan

or

1, n2 0
xn1 , n2 T n2
0, otherwise

Digital Signal Processing

or

A.S.Kayhan

1, n1 n2
xn1 , n2 T n1 n2
0, otherwise

Digital Signal Processing

A.S.Kayhan

Step sequence:

n1 , n2 0
otherwise

1,
un1 , n2
0,

un1 , n2

n1

n2

[k , k ].
1

k1 k 2

or
n1 , n2 un1 , n2 un1 1, n2 un1 , n2 1 un1 1, n2 1

Digital Signal Processing

A.S.Kayhan

Separable sequences:
A separable sequence can be written as

xn1 , n2 f1 n1 f 2 n2
The impulse is separable

n1 , n2 n1 n2

Periodic sequences:
~
x n1 , n2 is periodic with period N1xN2 if

~
x n1 , n2 ~
x n1 N1 , n2 ~
x n1 , n2 N 2
Example: Periodic with 2x4
~
x n1 , n2 cos n1 ( / 2)n2
Digital Signal Processing

A.S.Kayhan

Systems:
The relation between the input
of the system is given by

x n 1 , n 2 and the response

y n 1 , n 2 F x n 1 , n 2 .

Linearity: A system is linear if


F a x 1 n 1 , n 2 b x 2 n 1 , n 2

where

a y 1 n 1 , n 2 b y 2 n 1 , n 2 .

y i n 1 , n 2 F x i n 1 , n 2

, i 1, 2 .

Time Invariance: A system is time-invariant if


F x n 1 m 1 , n 2 m

y n 1

m 1 , n 2 m 2 .

Digital Signal Processing

Convolution:
For a LSI system with impulse response,
input/output relation is given by

A.S.Kayhan

h n 1 , n 2 ,the

yn1 , n2 xn1 , n2 * hn1 , n2

x[k , k ]h[n
1

k1 , n2 k 2 ].

k1 k 2

Where * denotes 2-D convolution.


Convolution with a delayed impulse :

xn1 , n2 * n1 m1 , n2 m2 x[n1 m1 , n2 m2 ].

Digital Signal Processing

A.S.Kayhan

Example:

Digital Signal Processing

y n1 , n 2

A.S.Kayhan

x [ k 1 , k 2 ] h [ n 1 k 1 , n 2 k 2 ].

k 1 k 2

Digital Signal Processing

A.S.Kayhan

If the impulse response is separable


hn1 , n2 h1 n1 h2 n2
then

yn1 , n2

x[k , k ]h [n
1

k1 ]h2 [n2 k 2 ]

k1 k 2

h [n
1

k1

h [n
1

k1 ] x[k1 , k 2 ]h2 [n2 k 2 ]


k 2

k1 ] f k1 , n2

k1

Digital Signal Processing

A.S.Kayhan

Stability:
A system is BIBO stable iff a bounded input leads to a
bounded output. If

h[n , n ]
1

n1 n2

then the system is BIBO stable.

Digital Signal Processing

A.S.Kayhan

Discrete Space Fourier Transform (2D F.T.):


2D Fourier Transform and its inverse are defined as

X (1 , 2 )

xn , n e
1

j1n1 j 2 n2

n1 n2

xn1 , n2

1
(2 ) 2

X (1 , 2 ) e j1n1 e j2 n2 d1d 2 .

X (1 , 2 ) is periodic with 2 in both variables.


X (1 , 2 ) X (1 2 , 2 ) X (1 , 2 2 ).

Digital Signal Processing

A.S.Kayhan

Digital Signal Processing

A.S.Kayhan

Example:

Frequency Response:
If the input to Linear Shift Invariant (LSI) system is

x[n1 , n2 ] e j1n1 e j2 n2
then

y[ n1 , n2 ] H (1 , 2 ) e j1n1 e j2 n2
where

H (1 , 2 )

hk , k e
1

j1k1 j2 k 2

k1 k 2

is the frequency response function of the system.

Digital Signal Processing

Example:
Given LPF

A.S.Kayhan

1, 1 a and 2 b
H (1 , 2 )
otherwise
0,

This function can be written as

H (1 , 2 ) H1 (1 ) H 2 ( 2 ).

Digital Signal Processing

A.S.Kayhan

then

h[n1 , n2 ] h1[n1 ] h2 [n2 ]

sin(an1 ) sin(bn2 )
.
n1
n2

Digital Signal Processing

A.S.Kayhan

Example:
Given impulse response and magnitude response of a 2D LPF
as

Digital Signal Processing

A.S.Kayhan

10

Original

LP-Filtered

HP-Filtered

Digital Signal Processing

A.S.Kayhan

Example:
Given frequency response of a 2D LPF as

1,
H (1 , 2 )
0,

12 22 c
12 22 c and 1 , 2

Digital Signal Processing

A.S.Kayhan

11

then the impulse response sequence is


c
h[n1 , n2 ]
J 1 c n12 n22
2 n12 n22

where J1(x) is the Bessel function.

Digital Signal Processing

A.S.Kayhan

2D Z-Transform:
2D Z-Transform is defined as

X ( z1 , z2 )

xn , n z
1

n1

z2

n2

n1 n2

where z1 and z2 are complex variables. The space


represented by (z1, z2) is four-dimesional (4-D).

Digital Signal Processing

A.S.Kayhan

12

Example:
Given 2D sequence

x[n1 , n2 ] a n1 b n2 un1 , n2

then

X ( z1 , z2 )

n1

b n2 un1 , n2 z1 n1 z 2 n2

n1 n2

a

n1 0 z1

n1

n2

b
1
1

, z1 a and z 2 b

1 az11 1 bz 21
n2 0 z 2

Digital Signal Processing

A.S.Kayhan

Inverse Z-Transform:
2-D polynomials, in general, can not be factored as a product
of lower order polynomials, therefore the partial fraction
expansion is not a general procedure for 2-D signals.

Linear, Constant Coefficient Difference Eq.:


LCCDE is given in the following form

ak , k yn
1

( k1 , k 2 ) R A

k1 , n2 k 2

bk , k xn
1

k1 , n2 k 2

( k1 , k 2 ) RB

where a and b are known, with boundary conditions.


Digital Signal Processing

A.S.Kayhan

13

Example:
Given an IIR filter with a first quadrant impulse response as

H ( z1 , z 2 )

1
1 0.5 z11 z21

then

H ( z1 , z 2 )

Y ( z1 , z 2 )
1

X ( z1 , z 2 ) 1 0.5 z11 z 21

Y ( z1 , z 2 ) 0.5 Y ( z1 , z 2 ) z11 z 21 X ( z1 , z 2 )
y[n1 , n2 ] 0.5 y[n1 1, n2 1] x[n1 , n2 ]

Digital Signal Processing

A.S.Kayhan

End of Part 4

Digital Signal Processing

A.S.Kayhan

14

Das könnte Ihnen auch gefallen