You are on page 1of 38

ELEN 5346/4304 DSP and Filter Design Fall 2008

1
Lecture 4: Frequency domain
representation, DTFT, IDTFT, DFT, IDFT
Instructor:
Dr. Gleb V. Tcheslavski
Contact: gleb@ee.lamar.edu
Office Hours: Room 2030
Class web site:
http://ee.lamar.edu/gleb/dsp/index.htm
ELEN 5346/4304 DSP and Filter Design Fall 2008
2
Some history
Jean Baptiste Joseph Fourier was born
in France in 1768. He attended the Ecole Royale
Militaire and in 1790 became a teacher there.
Fourier continued his studies at the Ecole
Normale in Paris, having as his teachers
Lagrange, Laplace, and Monge. Later on, he,
together with Monge and Malus, joined Napoleon
as scientific advisors to his expedition to Egypt
where Fourier established the Cairo Institute.
In 1822 Fourier has published his most
famous work: The Analytical Theory of Heat.
Fourier showed how the conduction of heat in
solid bodies may be analyzed in terms of infinite
mathematical series now called by his name, the
Fourier series.
ELEN 5346/4304 DSP and Filter Design Fall 2008
3
Frequency domain representation
0
cos( ) a (co)sinusoidal input
n
Let x A n +
frequency
0 0 0 0
( ) ( )
0 0 0 0
j n j j n j n j n
n
j
A A
e e e e
A A
x e e
+ +
+ +
complex exponent of
0
complex exponent of -
0
A sinusoidal signal is represented by TWO complex exponents of
opposite frequencies in the frequency domain.
(4.3.1)
(4.3.2)
ELEN 5346/4304 DSP and Filter Design Fall 2008
4
Frequency domain representation (cont)
( )
0 0 0 0 0
( ) j n j n k j k j n
n k k
k
n
k
j
n
Let x e h e h y H x e e e

_


,

@
( ) ( )
( )
:
phase
j
j H e
j j k j
k
k
magnitude
The frequency respon H e h e H e e se

00000
00000
Iff it exists!
( ) ( )
( )
( )
( )
( )
( ) ( )
( ) ( )
* *
*
:
j j
j n j n j n
n n n
n n n
j H e j H e
j j
j j
j j
j j
real H e H For a system h e h e h e
H e e H e
e
H e H e
H e H e
e





_


,

'



has a period of 2
( )
j
H e

(4.4.1)
(4.4.2)
(4.4.3)
(4.4.4)
ELEN 5346/4304 DSP and Filter Design Fall 2008
5
Frequency domain representation (cont 2)
For an arbitrary
real LTI system:
0 . 00 . 00 . 00 . 00 0 . 00 . 00 . 00 . 00 0
-000
-00
0
00
000
Normalized Frequency (

rad/sample)
P
h
a
s
e

(
d
e
g
r
e
e
s
)
0 . 00 . 00 . 00 . 00 0 . 00 . 00 . 00 . 00 0
-00
-00
-0
0
0
00
Normalized Frequency (

rad/sample)
M
a
g
n
i
t
u
d
e

(
d
B
)
Symmetric with
respect to
Anti-symmetric
with respect to
ELEN 5346/4304 DSP and Filter Design Fall 2008
6
Frequency domain representation (cont 3)
Combining (4.3.2) and (4.4.4) back to our sinusoid!
( ) ( )
{ }
( )
( )
( )
( )
( )
( ) ( )
0 0 0 0
0 0
0 0 0 0
0 0
0 0
0
Stady-state response:
0 0
0 0
0
j j
j j
j j n j j n j j
n
j H e j H e
j j n j j n j j
j n H e j n H e
j
A A
y e H e e e H e e real system
A A
e H e e e e H e e e
A
H e e e





1 1
+ + + +
1 1
] ]
+
+
_
+

,
LTI filtering: ( ) ( )
( )
0 0
0
cos
j j
n
y A H e n H e

+ +
due to the
input
change due to the system
same as
the input
from the
input
phase change due to the system
Via design, we manipulate H(e
j
), therefore, h
n
, and, finally, manipulate the
coefficients in the Linear Constant Coefficient Difference Equation (LCCDE)
(4.6.1)
(4.6.2)
(4.6.3)
(4.6.4)
ELEN 5346/4304 DSP and Filter Design Fall 2008
7
Frequency domain representation (cont 4)
LCCDE:
0
0
,
, 0
0
j n
j n n n
tot n i i
i
x e n
y c ke
initial conditions


+
)

if the system is BIBO ( ) , the frequency response exists


j j n
n n
n n
H e h e h

<

for large enough n:
0
,
j n
tot n
y ke

( )
0 0 0 0 0
0
( )
n
j n k j k j n
n k n k k
k k
j
n
j n
y h e u e e e H h e

1

1
]

0000000
(4.7.1)
(4.7.4)
(4.7.2)
(4.7.3)
ELEN 5346/4304 DSP and Filter Design Fall 2008
8
Frequency domain representation (cont 5)
for an LTI:
0
, ,
j n
n n n tr n ss n
x e u y y y

+
We dont need systems of order higher than 2: can always make cascades.
0 0
,
( ) ,
j j n
ss n
y H e e exists only for LTI BIBO systems


for a real, LTI, BIBO system:
0 0
, 0 0
cos( ) ( ) cos( ( )
j j
n ss n
x A n y A H e n H e

+ + +
effects of filtering
We cannot observe ANY frequency components in the output that are not
present in the input (in steady state). We may see less when ( ) 0
r
j
H e

(4.8.1)
(4.8.2)
ELEN 5346/4304 DSP and Filter Design Fall 2008
9
Frequency domain representation (cont 6)
In continuous time:
{we want}
t t t t t
x s n y c s distortion less transmission

+ ;
signal noise const delay
( )
( ) ( ) ( ) ( ) ( )
j t j t j j
t t
Y y e dt c s e d t e ce S H S




We need a constant magnitude and linear phase for the frequencies of interest.
Ideal filters:

0
( )
j
H e

0
( )
j
H e

LPF

0
( )
j
H e

HPF

0
( )
j
H e

BPF

0
( )
j
H e

BSF
Ideal filters are non-realizable!
(4.9.1)
(4.9.2)
ELEN 5346/4304 DSP and Filter Design Fall 2008
10
CTFT and ICTFT
(4.10.1)
(4.10.2)
( ) ( )
0
( ) ( )
0
j t
j t
X x t e dt
x t X e d

CTFT:
ICTFT:
Examples:
ELEN 5346/4304 DSP and Filter Design Fall 2008
11
DTFT
( )
, ,
j j n
n
n
a complex fun X e x ction periodic continuous on e

if exists
(4.11.1)
Whats about convergence???
1. Absolute convergence:
( )
0
i.e. converges absolutely or uniformly
j
n n
n
if x l x X e

, < ,

( ) ( )
.
( ) lim 0
k
j j n
k n
n k
abs er
j j
k
k
ror
Le X e t X e x e X e

000000000
(4.11.4)
(4.11.5)
( ) ( ) ( )
( )
( ) ( ) ( )
( )
( ) ( ) ( )
0
0 0
cos , sin
j j j j j j
re im
j j j
re im
X e X e X e X e X e X e
X e X e X e



+
(4.11.2)
(4.11.3)
ELEN 5346/4304 DSP and Filter Design Fall 2008
12
DTFT (cont)
0
0 0
0
. , :
cos( )
n
n
n
n
u
a are not l In fact they are not l x
A n

<
)

must be
2. Mean-square convergence:
( ) ( )
lim 0
energy of the
j j
err
k
r
k
o
X e X e

000000000
The total energy of the error must approach zero, not an error itself!
(4.12.1)
Absolutely summable sequences always have finite energy. However,
finite energy sequences are not necessary absolutely summable.
ELEN 5346/4304 DSP and Filter Design Fall 2008
13
IDTFT
( )
0
, 0
j n
j p
n
n
Let p is a period X e x e

0 0
( ) ( )
0
j j n
p
j j n
n
x X X e e d
p
e e d



IDTFT:
(4.13.1)
(4.13.2)
Combining (4.11.1) and (4.12.2)
0
0
j l j n
n l
l
x x e e d

[ ]
( )
sin ( )
0
( ) 0
j n l
l l l n l n
l l
n l
x e d x x x
n l

(4.13.3)
(4.13.4)
( )
j
X e

shows where x
n
lives in the frequency domain.
ELEN 5346/4304 DSP and Filter Design Fall 2008
14
Back to ideal filters
Ideal LPF:

0
( )
j
H e

2 0
1

c
( )
, 0 0
, 0
c
j
LP
c
H e

'
< <

Using IDTFT:
,
s n 0
,
i 0
0 0
c
c c
c
j n j n
j n
c
LP n
e e
e d
n
h n
jn jn n

_
< <

1. The response in (4.14.2) is not absolutely summable, therefore, the filter is


not BIBO stable!
2. The response in (4.14.2) is not causal and is of an infinite length.
(4.14.1)
(4.14.2)
As a result, the filter in (4.14.1) is not realizable.
Similar derivations show that none of the ideal filters in slide 9 is realizable.
ELEN 5346/4304 DSP and Filter Design Fall 2008
15
DTFT properties
( ) ( )
( )
( )
0
0
0 0
( )
:
:
:
:
j j
n n
DTFT
j n j
n n
DTFT
j n j
n
DTFT
n
D
Linearity ag bx aG e bX e
Shift in time g e G e
Shift in frequency e g G e
Differentiation n g



+ +



( )
( ) ( )
( ) ( )
( ) ( )
( )
* *
:
0
:
0
0
' :
0
j
TFT
j j
n n
DTFT
j j
n n
DTFT
j j
n n
n
dG e
j
d
Linear convolution g x G e X e
Periodic convolution g w G e W e d
Parseval s theorem g w G e W e d

(4.15.1)
(4.15.2)
(4.15.3)
(4.15.4)
(4.15.5)
(4.15.6)
continuous, periodic functions
(4.15.6)
ELEN 5346/4304 DSP and Filter Design Fall 2008
16
DTFTs of commonly used sequences
ELEN 5346/4304 DSP and Filter Design Fall 2008
17
DTFT examples
( )
0
0
( ) 0 0
j n j
n
DTFT
k
Let x e X e k

+

( )
0
( ) 0 0 0
j
n
DTFT
k
x X e k

+ 0

( ) ( ) ( )
0
0
( ) 0 0 0 0
0
j j j
n n n
j
DTFT
l
u u U e e U e c l
e

+ +

of DC value of u
n
0
( ) 0
0
n
j
DTFT
l
u l
e

+ +

( )
*
* * j n j n j
n n
n n
h e h e H e

_


,

( ) ( )
( ) ( )
( )
( )
0 0
0 0
0
0
j n j j n j n j j n
n n n n
n n n
j j
h g e H e e g e d H e g e d
H e G e d


(4.17.1)
(4.17.2)
(4.17.3)
(4.17.4)
(4.17.5)
(4.17.6)
ELEN 5346/4304 DSP and Filter Design Fall 2008
18
DTFT examples (cont)
We can re-work the Parsevals theorem (4.15.6) as follows:
( ) ( ) ( )
(
0
)
0 *
0
0
0
0
j
h
S
j
n n
j
n
j
e
Energy H E h d e e d H H e

00000
energy density (spectrum)
Autocorrelation function:
( ) ( ) ( )
*
( ) ,
* * * j j
n n l n l n l
j
gg l g
DTFT
l
n n
g g g g g g r G e G S e e




(4.18.1)
(4.18.2)
ELEN 5346/4304 DSP and Filter Design Fall 2008
19
DTFT examples (cont 2)
One obvious problem with DTFT is that we can never compute it since x
n

needs to be known everywhere! which is impossible!
Therefore, DTFT is not practical to compute.
Often, a finite dimension LTI system is described by LCCDE:
( ) ( )
( )
( )
( )
0 0 0
0
0
0
N M N M
j i j j m j
i n i m n m i m
DTFT
i m i m
j
j
M
j m
m
j
m
N
j i
i
i
b e
H e
a
a y b x a e Y e b e X e
Y e
X e
e

(4.19.2)
practical (finite
dimensions)
Prediction of steady-state behavior of LCCDE
(4.19.1)
ELEN 5346/4304 DSP and Filter Design Fall 2008
20
How to measure frequency response
of an actual (unknown) filter?
1. Perform two I/O experiments:
( ) ( ) ( )
( ) ( ) ( )
0 0
0 0
( ) ( ) ( )
, 0 0
( ) ( ) ( )
, 0 0
) cos( ) cos 0
) sin( ) sin 0
j j c c c
n n tr n
LTI
j j s s s
n n tr n
LTI
x A n y A H e n H e y
x A n y A H e n H e y



+ + + +

'
+ + + +

2. Analyze these measurements and form:


( )
( )
( )
( )
0
0
0
0
0
0
( ) ( ) ( )
( ) (
,
)
,
j
j
j n c s
n n n
j n H e
j c s
j H e
n
j
n
tr n
n
n n tr n
x x jx Ae
y y jy A H e e y
Finally
y
H e e z
x

+
1
+ +
1
]
+

'
+ +

+
%
%
%
%
%
Thats a good way to measure/estimate a frequency response for every .
(4.20.1)
(4.20.2)
(4.20.3)
(4.20.4)
(4.20.5)
ELEN 5346/4304 DSP and Filter Design Fall 2008
21
DFT and IDFT
Consider an N-sequence x
n
(at most N non-zero values for 0 n N-1)
( ) ( )
0
0
0
, , ,..., 00 0
k
N
j n j
n k
k
n
n
j j
n
N
n
x e X e X e x e k X N



uniformly spaced frequency samples
(4.21.1)
0
0
0
, , ,..., 00 0
N
j kn
N
k n
n
X x e k N

(4.21.2)
DFT:
Finite sum! Therefore, its computable.
0
Using notation:
j
N
N
W e


(4.21.1) can be rewritten as:
0
0
N
kn
k n N
n
X x W

0
0
: , ,. 00 , ..,
0
0
N
kn
n k N
n
IDFT n N x X W
N

(4.21.3)
(4.21.4)
(4.21.5)
Btw, DFT is a sampled version of DTFT.
ELEN 5346/4304 DSP and Filter Design Fall 2008
22
DFT and IDFT (cont)
Let us verify (4.21.5). We multiply both sides by
l n
N
W

0 0 0 0 0
( )
0 0 0 0 0
0 0
N N N N N
l n kn l n k l n
n N k N N k N
n n k n k
x W X W W X W
N N



_


,

0 0 0
( )
0 0 0
0
N N N
l n k l n
n N k N
n k n
x W X W
N





0
( )
0
, ,
, 0
N
k l n
N
n
N for k l rN r is Integer
Since W
otherwise


'

0
0
N
l n
n N l
n
x W X

(4.22.1)
(4.22.2)
(4.22.3)
(4.22.4)
ELEN 5346/4304 DSP and Filter Design Fall 2008
23
FFT
In the matrix form:
N
D T D x F X
where:
0 0 0
[ ... ]
T
N
x x x x time domain signal


0 0 0
[ ... ]
T
N
X X X X N DFT samples


0 0 0
( ) 0 0 0 0
( ) ( ) ( ) 0 0 0 0 0
0 0 0 0
0
0
0
N
N N N
N
N N N N
N N N N
N N N
W W W
D W DFT m W W
W W W
atrix



1
1
1
1
1
1
1

]

L
L
L
M M M O M
L
0
N
x D X IDFT


( ) 0 0 0
( ) 0 0 0 0 0
( ) ( ) ( ) ( ) 0 0 0 0 0
0 0 0 0
0
0
0
0
N
N N N
N
N N N N
N N N N
N N N
W W W
D W W W
N
W W W
IDFT matrix



1
1
1
1
1
1


1
]
L
L
L
M M M O M
L * 0
0
N N
D D
N

(4.23.1)
(4.23.2)
(4.23.3)
(4.23.4)
(4.23.5)
(4.23.6)
(4.23.7)
This is actually FFT
ELEN 5346/4304 DSP and Filter Design Fall 2008
24
Relation between DTFT and DFT
1. Sampling of DTFT
( )
j
n
DTFT
Let x X e


( ) ( ) { }
, , ,... point DFT 0 00 0
k
j j
k k
k
Sample X e at k N N frequency samples X e Y N
N


, , ,..., 00 0
k n
IDFT
Y y n N
( )
0
k
k
j
j kl
N
k l N
l
Y X e X e xW

_


,

0 0 0
( )
0 0 0
0 0 0
N N N
kn kl kn k n l
n k N l N N l N
k k l l k
y Y W xW W x W
N N N



1

1
]

, , ,..., 00 0
n n N
m
m
Considering y x n N

+
( . . 000 ) 0

(4.24.1)
(4.24.2)
(4.24.3)
y
n
is an infinite sum of shifted replicas of x
n
. Iff x
n
is a length M sequence (M N)
than y
n
= x
n
. Otherwise, time-domain aliasing x
n
cannot be recovered!
ELEN 5346/4304 DSP and Filter Design Fall 2008
25
Relation between DTFT and DFT (cont)
2. DTFT from DFT by Interpolation
Let x
n
be a length N sequence:
point
n k
N DFT
x X


Its possible to determine DTFT X(e
j
) from its uniformly sampled version uniquely!
Let us try to recover DTFT from DFT (its sampled version).
( )
0 0 0 0 0
0
0 0 0 0 0
0 0
kn
N N N N N
j
j j n kn j n j n
N
n k N k
n n k k n
X e x e X W e X e e
N N





1

1
]

0 0
( ) ( )/ 0 0 0 0
0
0
( / ) ( )/ 0 0 0
0
0 0
sin sin
0 0 0
0 0 0
sin sin
0 0
k k N
j N k j N k N
j n j
N N
j k N j k N
n
N k N k
e e
Since e e
N k N k e e
N N






_ _



, ,


_ _

, ,

_ _

, ,

( )
0 0
0
0
0
0
0
0
0
sin
0
0
0
s
0
sin
0
0
0
sin
0
in
0
k N
N
j
N
N
j
j
k
k
N
k
k
N N
X e X e
k
e
N
N
X
N k
N

_

,

,
,

_

,

(4.25.1)
(4.25.2)
(4.25.3)
ELEN 5346/4304 DSP and Filter Design Fall 2008
26
Relation between DTFT and DFT (cont 2)
3. Numerical computation of DTFT from DFT
Let x
n
is a length N sequence:
( )
j
n
DTFT
x X e


defined by N uniformly spaced samples
We wish to evaluate at more dense frequency scale.
( )
j
X e

/ , , ,..., , 0 00 0
k
k M k M where M N ?
( )
0 0
0
0 0
k k
n
N N
j k
j j n
M
n n
n n
X e x e x e




( )
0 0
0
, ,
0 0
k
n
M M
j k
j kn
M
l n l n M
n n
X e x e x W




No change in information, no change in DTFT just a better plot resolution.
(4.26.1)
,
, 00
, 0 0
n
l n
x n N
x
N n M

'

Define: zero-padding
(4.26.2)
(4.26.3)
ELEN 5346/4304 DSP and Filter Design Fall 2008
27
A note on W
N
0
Recall that:
j
N
N
W e


W
N
is also called an N
th
root of unity, since
0
0
j
N
N
W e


Re
Im
0
N

Re
Im
0
n
N

(4.27.1)
(4.27.2)
ELEN 5346/4304 DSP and Filter Design Fall 2008
28
DFT properties
1. Circular shift
x
n
is a length N sequence defined for n = 0,1,N-1.
An arbitrary shift applied to x
n
will knock it out of the 0N-1 range.
Therefore, a circular shift that always keeps the shifted sequence in
the range 0N-1 is defined using a modulo operation:
0
0 0
0
0
, ( modulo
0
, 0
, 0
N
n n
c n n n N n n
N n n
x n n N
x x x
x n n

)
+


'

0
0
0 0
0
( )
0
0
0
0
0
N
N
k n n
k N n n
k
N
kn kn kn
N k N N k
DFT
k
x X W
N
W X W W X
N

(4.28.1)
(4.28.2)
n
x
0 0
0 0 n n
x x
+

0 0
0 0 n n
x x
+

ELEN 5346/4304 DSP and Filter Design Fall 2008


29
DFT properties (cont)
2. Circular convolution
A linear convolution for two length N sequences x
n
and g
n
has a length 2N-1:
0
,
0
, 000
N
L n m n m
m
y g x n N

A circular convolution is a length-N sequence defined as:


0
,
0
N
N
C n m n n n n n m
m
y g x g x x g

N
N
0 0 0 0 0
( )
0 0 0 0 0
0
0
0 0
0
N
n m
N
N N N N N
k n m km kn
m m k N l N k N n m
m m k k m
x
N
kn
k k N k k
DFT
k
g x g X W g W X W
N N
G X W G X
N

000000000
(4.29.1)
(4.29.2)
(4.29.3)
Procedure: take two sequences of the same length (zero-pad if needed),
DFT of them, multiply, IDFT: a circular convolution.
ELEN 5346/4304 DSP and Filter Design Fall 2008
30
DFT properties (cont 2)
Example:
( )
j j n
n
n
X e x e

Take N frequency samples of (4.30.1) and then IDFT:


( . . 000
0 0
0 0
0 0
0
( )
0
) 0
0 0
0
n l rN
r
N N
j kl j
kn kn
N N
k N l N N
k k l
N
k n
n
n
l
l N r
l
N
r k
X W x e W W e
N N
x W
N
x
x



' )



0000000
%
aliased version of x
n
(4.30.1)
(4.30.2)
The results of circular convolution differ from the linear convolution on the edges
caused by aliasing.
To avoid aliasing, we need to use zero-padding
ELEN 5346/4304 DSP and Filter Design Fall 2008
31
Linear filtering via DFT
Often, we need to process long data sequences; therefore, the input
must be segmented to fixed-size blocks prior LTI filtering. Successive
blocks are processed one at a time and the output blocks are fitted
together
n n n
y h x
Assuming that h
n
is an M-sequence, we form an N-sequence (L - block
length):
(4.31.1)
,
0
0
n
m n
x mL n mL L
x
otherwise
+

'

We can do it by FFT: IFFT{FFT{x}FFT{h}}


N >> M; L >> M; N = L + M - 1 and is a power of 2
Problem: DFT implies circular convolution aliasing!
(4.31.2)
ELEN 5346/4304 DSP and Filter Design Fall 2008
32
Linear filtering via DFT (cont)
Next, we compute N-point DFTs of x
m,n
and h
n
, and form
, ,
, ,... 00 0
m k k m k
k N Y H X ,
, , m k m n
IDFT
Y y
(4.32.1)
- no aliasing!
Since each data block was terminated
with M -1 zeros, the last M -1 samples
from each block must be overlapped
and added to first M 1 samples of
the succeeded block.
An Overlap-Add method.
ELEN 5346/4304 DSP and Filter Design Fall 2008
33
Linear filtering via DFT (cont 2)
Alternatively:
Each input data block contains M -1
samples from the previous block followed
by L new data samples; multiply the N-
DFT of the filters impulse response and
the N-DFT of the input block, take IDFT.
Keep only the last L data samples from
each output block.
An Overlap-Save method.
The first block is padded by M-1 zeros.
ELEN 5346/4304 DSP and Filter Design Fall 2008
34
DFT properties: General
from Mitras
book
Btw, g[n] = g
n
ELEN 5346/4304 DSP and Filter Design Fall 2008
35
DFT properties: Symmetry
from Mitras
book
x
n
is a real
sequence
ELEN 5346/4304 DSP and Filter Design Fall 2008
36
DFT properties: Symmetry (cont)
from Mitras
book
x
n
is a complex
sequence
ELEN 5346/4304 DSP and Filter Design Fall 2008
37
N-point DFTs of 2 real sequences
via a single N-point DFT
Let g
n
and h
n
are two length N real sequences.
{ }
{ }
*
*
0
0
0
0
N
N
k k k
k k k
G X X
H X X
j

+

Form x
n
= g
n
+ jh
n
X
k
* *
N N
k N k
Note that X X


(4.37.1)
(4.37.2)
(4.37.3)
(4.37.4)
ELEN 5346/4304 DSP and Filter Design Fall 2008
38
Summary
Algorithm Time Frequency
CTFT Continuous Continuous
DTFT Discrete Continuous
DFT Discrete Discrete

You might also like