The Discrete Fourier Transform - Sharif University of Technology

Department of Computer Eng.
Sharif University of Technology
Discrete-time signal processing
Chapter 8:
THE DESCRETE FOURIER
TRANSFORM
Content and Figures are from Discrete-Time Signal Processing, 2e by Oppenheim, Shafer and Buck, ©1999-2000 Prentice Hall Inc.
8.0
Introduction
DSP
• For finite-duration sequences, it is possible to develop
an alternative Fourier representation referred to as the
discrete Fourier transform(DFT).
• It is a sequence rather than a continuous variable.
• It corresponds to samples, equally spaced in frequency,
of the Fourier transform of the signal.
• The importance of DFT is because efficient algorithms
exists for the computation of the DFT (FFT).
Chapter 8: The Discrete Fourier Transform
1
8.1
DSP
Discrete Fourier Series
• Given a periodic sequence x[ n] with period N so that
x[n]  x[n  rN ]
• The Fourier series representation of continuous-time
periodic signals require infinite complex exponentials.
• But for discrete-time periodic signals we have
e j 2 / N  k mN n  e j 2 / N kne j 2 mn  e j 2 / N kn
• Due to the periodicity of the complex exponential we only
need N exponentials for discrete time Fourier series
1
x[n] 
N

k  N 
X k  e
j  2 / N  kn
1

N
N 1
j  2 / N  kn
X
k
e



k 0
Chapter 8: The Discrete Fourier Transform
2
DSP
Discrete Fourier Series Pair
• A periodic sequence in terms of Fourier series coefficients
1
x[n] 
N
N 1
j  2 / N  kn
X
k
e



k 0
• The Fourier series coefficients can be obtained via
N 1
X  k    x[n]e  j  2 / N kn
n 0
• For convenience we sometimes use
WN  e j  2 / N 
• Analysis equation
N 1
X  k    x[n]WNkn
• Synthesis equation
1
x[n] 
N
n 0
N 1
 X  k W
k 0
 kn
N
Chapter 8: The Discrete Fourier Transform
3
DSP
Example 1 1
• DFS of a periodic impulse train
1 n  rN
x[n]     n  rN   
r 
0 else

• Since the period of the signal is N
N 1
X  k    x[n]e
 j  2 / N  kn
n 0
N 1
   [n]e  j  2 / N kn  e  j  2 / N k 0  1
n 0
• We can represent the signal with the DFS coefficients as

1
x[n]     n  rN  
N
r 
N 1
j  2 / N  kn
e

k 0
Chapter 8: The Discrete Fourier Transform
4
DSP
Example 2: Duality in the DFT
• Here let the Fourier series coefficients be the periodic
impulse train Y[k] , and given by this equation:
Y [k ] 

 N [k  rN ]
r 
• Substituting Y[k] in to DFS equation gives
1
y[n] 
N
N 1
 N [k ]W
k 0
 kn
N
 WN0  1
• Comparing this result with the results for example1 we see
that Y[k]=Nx[k] and y[n]=X[n].
Chapter 8: The Discrete Fourier Transform
5
DSP
Example 3
• DFS of an periodic rectangular pulse train
• The DFS coefficients
4
X k    e
n 0
 j  2 /10  kn
1  e j  2 /10k 5
 j  4 k /10  sin  k / 2 


e
sin  k /10 
1  e j  2 /10k
Chapter 8: The Discrete Fourier Transform
6
8.2
DSP
Properties of DFS
• Linearity (all signals have the same period)
x1  n
x2  n
X1  k 
DFS


X 2 k 
DFS


DFS
ax1  n  bx2  n  
 aX 1  k   bX 2  k 
• Shift of a Sequence
0  m  N 1
x  n
x  n  m
DFS


DFS

 e j 2 km / N X  k 
DFS
e j 2 nm / N x  n 

• Duality
x  n
X k 
DFS


X  k  m
X k 
DFS
X  n 
 Nx  k 
Chapter 8: The Discrete Fourier Transform
7
DSP
Periodic Convolution
• Take two periodic sequences
DFS
x1  n 

X1  k 
DFS
x2  n 
 X 2 k 
• Let’s form the product
X 3  k   X1  k  X
2
k 
• The periodic sequence with given DFS can be written as
N 1
x3  n    x1  m x2  n  m 
m 0
• Periodic convolution is commutative
N 1
x3  n    x2  m x1  n  m 
m 0
Chapter 8: The Discrete Fourier Transform
8
DSP
Periodic Convolution Cont’d
N 1
x3  n    x1  m x2  n  m 
m 0
• Substitute periodic convolution into the DFS equation
 N 1

X 3  k      x1[m]x2 [n  m] WNkn
n 0  m 0

N 1
• Interchange summations
 N 1

X 3  k    x1[m]   x2 [n  m]WNkn 
m 0
 n 0

N 1
• The inner sum is the DFS of shifted sequence
N 1
• Substituting
kn
km
x
[
n

m
]
W

W
 2
N
N X 2 k 
n 0
N 1
 N 1
kn 
X 3  k    x1[m]   x2 [n  m]WN    x1[m]WNkm X 2  k  X 1  k  X 2 k 
m 0
 n 0
 m 0
N 1
Chapter 8: The Discrete Fourier Transform
9
Graphical Periodic Convolution
Chapter 8: The Discrete Fourier Transform
DSP
10
Symmetry Properties
Chapter 8: The Discrete Fourier Transform
DSP
11
Symmetry Properties Cont’d
Chapter 8: The Discrete Fourier Transform
DSP
12
8.3 The Fourier Transform of Periodic Signals DSP
• Periodic sequences are not absolute or square summable
– Hence they don’t have a Fourier Transform
• We can represent them as sums of complex exponentials: DFS
• We can combine DFS and Fourier transform
• Fourier transform of periodic sequences
– Periodic impulse train with values proportional to DFS coefficients

2
2 k 

j
X e   
X  k    

N
N


k 
– This is periodic with 2 since DFS is periodic
• The inverse transform can be written as
1
2

2  
0 
1
N
 
X e

j
e
j n
 X  k 
k 
1
d 
2
2  
0 

2 
0 
2
2 k  jn

X
k







e d 
N 

k  N

2 k  jn
1

  
e
d



N
N


N 1
 X k  e
j
2 k
n
N
k 0
Chapter 8: The Discrete Fourier Transform
13
DSP
Example
• Consider the periodic impulse train
p[n] 

   n  rN 
r 
• The DFS was calculated previously to be
P  k   1 for all k
• Therefore the Fourier transform is
 
P e
j

2 
2 k 






N
N


k 

Chapter 8: The Discrete Fourier Transform
14
Relation between Finite-length and Periodic Signals
DSP
• Consider finite length signal x[n] spanning from 0 to N-1
• Convolve with periodic impulse train

x[n]  x[n]  p[n]  x[n]     n  rN  
r 

 x n  rN 
r 
• The Fourier transform of the periodic sequence is
   X  e  P  e   X  e   2N     2Nk 
X e
j
j
j

j
k 
 
X e
j
2  j 2N k
 
X e
k  N


 
2 k 



 

N



• This implies that
 j 2N k 
j
X k   X  e
 X e


 

2 k
N
• DFS coefficients of a periodic signal can be thought as equally
spaced samples of the Fourier transform of one period
15
DSP
Example
• Consider the following
sequence
WN  e
 j  2 / N 
• The Fourier transform
 
X e j  e  j 2
sin  5 / 2 
sin  / 2 
• The DFS coefficients
X k   e
 j  4 k /10 
sin  k / 2 
sin  k /10 
Chapter 8: The Discrete Fourier Transform
16
8.4
Sampling the Fourier Transform
DSP
• Consider an aperiodic sequence with a Fourier transform
 
DTFT
x[n] 
 X e j
• Assume that a sequence is obtained by sampling the DTFT
 
X  k   X e j
  2 / N  k

 X e j  2 / N k

• Since the DTFT is periodic resulting sequence is also periodic
• We can also write it in terms of the z-transform

X  k   X  z  z e2 / N k  X e j  2 / N k

• The sampling points are shown in figure
• X  k could be the DFS of a sequence
• Write the corresponding sequence
1
x[n] 
N
N 1
j  2 / N  kn
X
k
e



k 0
Chapter 8: The Discrete Fourier Transform
17
DSP
Sampling the Fourier Transform Cont’d
• The only assumption made on the sequence is that DTFT exist

    x m e
X e
j

X k   X e
 j m
m 
j  2 / N  k

1
x[n] 
N
N 1
 X k  e  
j 2 / N  kn
k 0
• Combine equation to get
 
 j  2 / N  km  j  2 / N  kn
x
m
e




e
k  0  m 


 1 N 1 j  2 / N k  n  m   
  x  m   e
  x m p n  m

m 
 N k 0
 m 
1
x[n] 
N
N 1
• Term in the parenthesis is
1
p  n  m 
N
• So we get
N 1
e
j  2 / N  k  n  m 

k 0

   n  m  rN 

r 

r 
r 
x[n]  x  n      n  rN  
 x n  rN 
Chapter 8: The Discrete Fourier Transform
18
Sampling the Fourier Transform Cont’d
Chapter 8: The Discrete Fourier Transform
DSP
19
Sampling the Fourier Transform Cont’d
DSP
• Samples of the DTFT of an aperiodic sequence can be thought
of as DFS coefficients of a periodic sequence obtained
through summing periodic replicas of original sequence.
• If the original sequence is of finite length and we take
sufficient number of samples of its DTFT the original
sequence can be recovered by
 x  n 0  n  N  1
x  n  
else
 0
• It is not necessary to know the DTFT at all frequencies To
recover the discrete-time sequence in time domain
• Discrete Fourier Transform representing a finite length
sequence by samples of DTFT
Chapter 8: The Discrete Fourier Transform
20
8.5
The Discrete Fourier Transform
DSP
• Consider a finite length sequence x[n] of length N
x  n  0 outside of 0  n  N  1
• For given length-N sequence associate a periodic sequence
x  n 

 x  n  rN 
r 
• The DFS coefficients of the periodic sequence are samples of
the DTFT of x[n]
• Since x[n] is of length N there is no overlap between terms of
x[n-rN] and we can write the periodic sequence as
x  n  x  n mod N   x   n   N 
• To maintain duality between time and frequency
– We choose one period of X  k as the Fourier transform of x[n]
 X k  0  k  N 1
X k   
else
 0
X  k   X  k mod N   X   k   N 
Chapter 8: The Discrete Fourier Transform
21
The Discrete Fourier Transform Cont’d
DSP
• The DFS pair
N 1
X  k    x[n]e
1
x[n] 
N
 j  2 / N  kn
n 0
N 1
j  2 / N  kn
X
k
e



k 0
• The equations involve only on period so we can write
 N 1
 j  2 / N  kn
x
[
n
]
e

X  k    n 0

0

1

x[n]   N


N 1
0  k  N 1
j  2 / N  kn
X
k
e



else
0  n  N 1
k 0
0
Chapter 8: The Discrete Fourier Transform
else
22
The Discrete Fourier Transform Cont’d
DSP
• The DFT pair can also be written as
DFT
X k  
 x[n]
• The Discrete Fourier Transform
 N 1
 j  2 / N  kn
x
[
n
]
e

X  k    n 0

0

1

x[n]   N


N 1
0  k  N 1
j  2 / N  kn
X
k
e



else
0  n  N 1
k 0
0
Chapter 8: The Discrete Fourier Transform
else
23
DSP
Example
• The DFT of a rectangular pulse
• x[n] is of length 5
• We can consider x[n] of any
length greater than 5
• Let’s pick N=5
• Calculate the DFS of the
periodic form of x[n]
4
X  k    e  j  2 k / 5  n
n 0
1  e  j 2 k

1  e  j  2 k / 5 
5 k  0, 5, 10,...

else
0
Chapter 8: The Discrete Fourier Transform
24
Example Cont’d
DSP
• If we consider x[n] of length 10
• We get a different set of DFT
coefficients
• Still samples of the DTFT but in
different places
Chapter 8: The Discrete Fourier Transform
25
8.6
DSP
Properties of DFT
• Linearity
x1  n
DFT


x2  n
DFT


X1  k 
X 2 k 
DFT
ax1  n  bx2  n 
 aX 1  k   bX 2  k 
• Duality
x  n
DFT


X k 
DFT
X  n 
 Nx   k   N 
• Circular Shift of a Sequence
x  n
DFT


X k 
DFT
x   n  m   N  0  n  N-1 
 X  k  e j  2 k / N m
Chapter 8: The Discrete Fourier Transform
26
Example: Duality
Chapter 8: The Discrete Fourier Transform
DSP
27
Symmetry Properties
Chapter 8: The Discrete Fourier Transform
DSP
28
Circular Convolution
DSP
• Circular convolution of two
finite length sequences
N 1
x3  n    x1  m  x2   n  m   N 
m 0
N 1
x3  n    x2  m  x1   n  m   N 
m 0
Chapter 8: The Discrete Fourier Transform
29
DSP
Example
• Circular convolution of two rectangular pulses L=N=6
1 0  n  L  1
x1  n  x2  n   
else
0
• DFT of each sequence
N 1  j 2 kn
N
X1  k   X 2  k    e
n 0
N

0
k 0
else
• Multiplication of DFTs
N 2
X 3  k   X1  k  X 2  k   
0
k 0
else
• And the inverse DFT
N
x3  n  
0
0  n  N 1
else
Chapter 8: The Discrete Fourier Transform
30
DSP
Example
• We can augment zeros to
each sequence L=2N=12
• The DFT of each sequence
X1 k   X 2 k  
1 e
j
1 e
2 Lk
N
j
2 k
N
• Multiplication of DFTs
2 Lk
j

1 e N

X 3 k  
2 k

j
 1 e N






2
Chapter 8: The Discrete Fourier Transform
31
8.7
Linier convolution using the DFT
DSP
• Efficient algorithms are available for computing the DFT of
finite-duration sequence, therefore it is computationally
efficient to implement a convolution of two sequences by the
following procedure:
– Compute the N point discrete Fourier transforms X1[k] and X2[k] for
the two sequences given.
– Compute the product X3[k]=X1[k]X2[k].
– Compute the inverse DFT of X3[k].
• The multiplication of discrete Fourier transforms
corresponds to a circular convolution. To obtain a linear
convolution, we must ensure that circular convolution has
the effect of linear convolution.
Chapter 8: The Discrete Fourier Transform
32
Linear convolution of two finite-length sequences
x3  k  
DSP

 x  m x  n  m
m 
1
2
Chapter 8: The Discrete Fourier Transform
33
Circular convolution as linear convolution
DSP
With aliasing
Without aliasing
Chapter 8: The Discrete Fourier Transform
34
DSP
DSP
DSP
Implementing LTI systems using the DFT
DSP
• Let us consider an L point input sequence x[n] and a p point
impulse response h[n].
• The linear convolution has finite-duration with length L+P-1.
• consequently for linear convolution and circular convolution
to be identical, the circular convolution must have the length
of at least L+p-1 points.
• i.e. both x[n] and h[n] must be augmented with sequence
amplitude with zero amplitude.
• This process is often referred to as zero-padding.
Chapter 8: The Discrete Fourier Transform
38
Implementing LTI systems using the DFT cont’d
DSP
• In many applications the input signal is an indefinite
duration.
– We have to store all the input data.
– No filtered samples calculated until all the input samples have been
collected.
– Implementing FFT for such large number of points is impractical.
• The solution is to use block convolution.
• In this method signal is segmented into sections and each
section can then be convolved with the finite length impulse
response and the filtered sections fitted together in an
appropriate way.
Chapter 8: The Discrete Fourier Transform
39
Implementing LTI systems using the DFT cont’d
Chapter 8: The Discrete Fourier Transform
DSP
40
DSP
Overlap-add method

x  n    xr  n  rL 
r 0
 x[n  rL], 0  n  L  1
xr [n]  
otherwise
 0,

y[n]  x  n   h[n]   yr  n  rL 
r 0
yr [n]  xr [n]* h[n]
Chapter 8: The Discrete Fourier Transform
41
Overlap-add method
DSP
• xr[n] has L nonzero points and
h[n] is of length P, each of yr[n]
has length L+P-1.
• A method to implement linear
convolution is the nonzero
points in the filtered sections
will overlap by P-1 points and
these overlap samples must be
added to compute linear
convolution.
• This method is called overlapadd method.
Chapter 8: The Discrete Fourier Transform
42
Overlap-Save Method
DSP
Overlap-save method
DSP
• It corresponds to implementing an
L-point circular convolution of a Ppoint impulse response h[n] with
an L-point segment xr[n] and
identifying the part of singular
convolution that corresponds to
linear convolution.
• We showed that if an L-point
sequence is circularly convolved
with a P-point sequence (P<L)
then the first P-1 point of result
are incorrect.
• This method is called overlap-save
method.
Chapter 8: The Discrete Fourier Transform
44