0% found this document useful (0 votes)
36 views

Advanced Training Course On FPGA Design and VHDL For Hardware Simulation and Synthesis

The document discusses the discrete Fourier transform (DFT) and some of its key properties. It begins by defining the DFT and providing the analysis and synthesis equations. It then covers the following main points: - The DFT is cyclic, with period N, in both the time and frequency domains. - It is useful to consider the periodic extensions of signals when working with the DFT. - Important properties of the DFT include symmetry, linearity, and how it is affected by circular time shifts and circular convolution. - Circular convolution with the DFT is equivalent to periodic convolution in the time domain.

Uploaded by

Lalita Kumari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Advanced Training Course On FPGA Design and VHDL For Hardware Simulation and Synthesis

The document discusses the discrete Fourier transform (DFT) and some of its key properties. It begins by defining the DFT and providing the analysis and synthesis equations. It then covers the following main points: - The DFT is cyclic, with period N, in both the time and frequency domains. - It is useful to consider the periodic extensions of signals when working with the DFT. - Important properties of the DFT include symmetry, linearity, and how it is affected by circular time shifts and circular convolution. - Circular convolution with the DFT is equivalent to periodic convolution in the time domain.

Uploaded by

Lalita Kumari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

2065-25

Advanced Training Course on FPGA Design and VHDL for


Hardware Simulation and Synthesis

26 October - 20 November, 2009

Digital Signal Processing


The Discrete Fourier Transform

Massimiliano Nolich
DEEI
Facolta' di Ingegneria Universita' degli Studi di Trieste
via Valerio, 10, 34127
Trieste
Italy
The Discrete Fourier Transform
The discrete-time Fourier transform (DTFT) of a sequence is a continuous
function of !, and repeats with period 2. In practice we usually want to
obtain the Fourier components using digital computation, and can only
evaluate them for a discrete set of frequencies. The discrete Fourier transform
(DFT) provides a means for achieving this.
The DFT is itself a sequence, and it corresponds roughly to samples, equally
spaced in frequency, of the Fourier transform of the signal. The discrete
Fourier transform of a length N signal xŒn, n D 0; 1; : : : ; N 1 is given by
N
X1
j.2=N /k n
XŒk D xŒne :
nD0

This is the analysis equation. The corresponding synthesis equation is


N 1
1 X
xŒn D XŒke j.2=N /k n :
N
kD0

When dealing with the DFT, it is common to define the complex quantity
j.2=N /
WN D e :

With this notation the DFT analysis-synthesis pair becomes


N
X1
XŒk D xŒnWNk n
nD0
N 1
1 X
xŒn D XŒkWN k n :
N
kD0

An important property of the DFT is that it is cyclic, with period N , both in the

1
discrete-time and discrete-frequency domains. For example, for any integer r,
N
X1 N
X1
XŒk C rN  D xŒnWN.kCrN /n D xŒnWNk n .WNN /rn
nD0 nD0
N
X1
D xŒnWNk n D XŒk;
nD0

since WNN D e j.2=N /N D e j 2 D 1. Similarly, it is easy to show that


xŒn C rN  D xŒn, implying periodicity of the synthesis equation. This is
important — even though the DFT only depends on samples in the interval 0 to
N 1, it is implicitly assumed that the signals repeat with period N in both
the time and frequency domains.
To this end, it is sometimes useful to define the periodic extension of the signal
xŒn to be
xŒn
Q D xŒn mod N  D xŒ..n//N :
Here n mod N and ..n//N are taken to mean n modulo N , which has the value
of the remainder after n is divided by N . Alternatively, if n is written in the
form n D kN C l for 0  l < N , then

n mod N D ..n//N D l:
xŒn

n
0 N
xŒn
Q

n
0 N
Similarly, the periodic extension of XŒk is defined to be
Q
XŒk D XŒk mod N  D XŒ..k//N :

2
It is sometimes better to reason in terms of these periodic extensions when
dealing with the DFT. Specifically, if XŒk is the DFT of xŒn, then the inverse
DFT of XŒk is xŒn.
Q The signals xŒn and xŒn
Q are identical over the interval 0
to N 1, but may differ outside of this range. Similar statements can be made
regarding the transform XŒk.

1 Properties of the DFT


Many of the properties of the DFT are analogous to those of the discrete-time
Fourier transform, with the notable exception that all shifts involved must be
considered to be circular, or modulo N .
D D D
Defining the DFT pairs xŒn !XŒk, x1 Œn !X1 Œk, and x2 Œn !XŒk,
the following are properties of the DFT:
 Symmetry:

XŒk D X  Œ.. k//N 


RefXŒkg D RefXŒ.. k//N g
ImfXŒkg D ImfXŒ.. k//N g
jXŒkj D jXŒ.. k//N j
^XŒk D ^XŒ.. k//N 

D
 Linearity: ax1 Œn C bx2 Œn !aX1 Œk C bX2 Œk.
D
 Circular time shift: xŒ..n m//N  !WNkm XŒk.
 Circular convolution:
N
X1 D
x1 Œmx2 Œ..n m//N  !X1 ŒkX2 Œk:
mD0

Circular convolution between two N-point signals is sometimes denoted


by x1 Œn
N xŒn.

3
 Modulation:
N 1
D 1 X
x1 Œnx2 Œn ! X1 ŒlX2 Œ..k l//N :
N
lD0

Some of these properties, such as linearity, are easy to prove. The properties
involving time shifts can be quite confusing notationally, but are otherwise
quite simple. For example, consider the 4-point DFT
3
X
XŒk D xŒnW4k n
nD0

of the length 4 signal xŒn. This can be written as

XŒk D xŒ0W40k C xŒ1W41k C xŒ2W42k C xŒ3W43k

The product W41k XŒk can therefore be written as

W41k XŒk D xŒ0W41k C xŒ1W42k C xŒ2W43k C xŒ3W44k


D xŒ3W40k C xŒ0W41k C xŒ1W42k C xŒ2W43k

since W44k D W40k . This can be seen to be the DFT of the sequence
xŒ3; xŒ0; xŒ1; xŒ2, which is precisely the sequence xŒn circularly shifted to
the right by one sample. This proves the time-shift property for a shift of
length 1. In general, multiplying the DFT of a sequence by WNkm results in an
N-point circular shift of the sequence by m samples. The convolution
properties can be similarly demonstrated.
It is useful to note that the circularly shifted signal xŒ..n m//N  is the same
as the linearly shifted signal xŒn
Q m, where xŒn
Q is the N-point periodic
extension of xŒn.

4
xŒn

n
0 N
xŒn
Q

n
0 N
xŒn
Q m

n
0 N
xŒ..n m//N 

n
0 N

On the interval 0 to N 1, the circular convolution


N
X1
x3 Œn D x1 Œn
N x2 Œn D x1 Œmx2 Œ..n m//N 
mD0

can therefore be calculated using the linear convolution product


N
X1
x3 Œn D x1 ŒmxQ 2 Œn m:
mD0

Circular convolution is really just periodic convolution.


Example: Circular convolution with a delayed impulse sequence
Given the sequences

x1 Œn x2 Œn
n n
0 N 0 N

5
the circular convolution x3 Œn D x1 Œn
N x2 Œn is the signal xŒn
Q delayed by
two samples, evaluated over the range 0 to N 1:

x3 Œn
n
0 N

Example: Circular convolution of two rectangular pulses


Let 8
<1 0nL 1
x1 Œn D x2 Œn D
:0 otherwise:
If N D L, then the N-point DFTs are
8
N
X1 <N kD0
X1 Œk D X2 Œk D WNk n D
:0 otherwise:
nD0

Since the product is


8
<N 2 kD0
X3 Œk D X1 ŒkX2 Œk D
:0 otherwise;

it follows that the N-point circular convolution of x1 Œn and x2 Œn is

x3 Œn D x1 Œn
N x2 Œn D N; 0nN 1:

Suppose now that x1 Œn and x2 Œn are considered to be length 2L sequences by
augmenting with zeros. The N D 2L-point circular convolution is then seen to
be the same as the linear convolution of the finite-duration sequences x1 Œn and
x2 Œn:

6
x1 Œn D x2 Œn

n
0 L N

L
x1 Œn
N x2 Œn

n
0 L N

2 Linear convolution using the DFT


Using the DFT we can compute the circular convolution as follows
 Compute the N -point DFTs X1 Œk and X2 Œk of the two sequences x1 Œn
and x2 Œn.
 Compute the product X3 Œk D X1 ŒkX2 Œk for 0  k  N 1.
 Compute the sequence x3 Œn D x1 Œn
N x2 Œn as the inverse DFT of
X3 Œk.
This is computationally useful due to efficient algorithms for calculating the
DFT. The question that now arises is this: how do we get the linear convolution
(required in speech, radar, sonar, image processing) from this procedure?

2.1 Linear convolution of two finite-length sequences

Consider a sequence x1 Œn with length L points, and x2 Œn with length P
points. The linear convolution of the sequences,
1
X
x3 Œn D x1 Œmx2 Œn m;
mD 1

is nonzero over a maximum length of L C P 1 points:

7
2

x [n]
1
0
0 L

1
x [n]
2

0
0 P
8
x [n]
3

0
0 L+P−1
n

Therefore L C P 1 is the maximum length of x3 Œn resulting from the linear


convolution.
The N-point circular convolution of x1 Œn and x2 Œn is
N
X1 N
X1
x1 Œn
N x2 Œn D x1 Œmx2 Œ..n m//N  D x1 ŒmxQ 2 Œn m W
mD0 mD0

It is easy to see that the circular convolution product will be equal to the linear
convolution product on the interval 0 to N 1 as long as we choose
N  L C P 1. The process of augmenting a sequence with zeros to make it
of a required length is called zero padding.

2.2 Convolution by sectioning

Suppose that for computational efficiency we want to implement a FIR system


using DFTs. It cannot in general be assumed that the input signal has a finite
duration, so the methods described up to now cannot be applied directly:

8
h[n]
0 P
x[n]

0 L 2L 3L
n
The solution is to use block convolution, where the signal to be filtered is
segmented into sections of length L. The input signal xŒn, here assumed to be
causal, can be decomposed into blocks of length L as follows:
1
X
xŒn D xr Œn rL;
rD0

where 8
<xŒn C rL 0nL 1
xr Œn D
:0 otherwise:
x0[n]

0 L
n
x1[n]

L 2L
n
x2[n]

2L 3L
n

9
The convolution product can therefore be written as
1
X
yŒn D xŒn  hŒn D yr Œn rL;
rD0

where yr Œn is the response

yr Œn D xr Œn  hŒn:


y0[n]

0 L+P−1
n
y1[n]

L
n
y2[n]

2L
n

Since the sequences xr Œn have only L nonzero points and hŒn is of length P ,
each response term yr Œn has length L C P 1. Thus linear convolution can
be obtained using N-point DFTs with N  L C P 1. Since the final result is
obtained by summing the overlapping output regions, this is called the
overlap-add method.
y[n]

0 L 2L 3L

An alternative block convolution procedure, called the overlap-save method,


corresponds to implementing an L-point circular convolution of a P-point

10
impulse response hŒn with an L-point segment xr Œn. The portion of the
output that corresponds to linear convolution is then identified (consisting of
L .P 1/ points), and the resulting segments patched together to form the
output.

3 Spectrum estimation using the DFT


Spectrum estimation is the task of estimating the DTFT of a signal xŒn. The
DTFT of a discrete-time signal xŒn is
1
X
j! j!n
X.e /D xŒne :
nD 1

The signal xŒn is generally of infinite duration, and X.e j! / is a continuous


function of !. The DTFT can therefore not be calculated using a computer.
Consider now that we truncate the signal xŒn by multiplying with the
rectangular window wr Œn:
1
w [n]

0.5
r

0
0 N−1
n
The windowed signal is then xw Œn D xŒnwr Œn. The DTFT of this windowed
signal is given by
1
X N
X1
Xw .e j! / D xw Œne j!n
D xw Œne j!n
:
nD 1 nD0

Noting that the DFT of xw Œn is


N
X1 2k n
j
Xw Œk D xw Œne N ;
nD0

11
it is evident that
Xw Œk D Xw .e j! /ˇ!D2k=N :
ˇ

The values of the DFT Xw Œk of the signal xw Œn are therefore periodic
samples of the DTFT Xw .e j! /, where the spacing between the samples is
2=N . Since the relationship between the discrete-time frequency variable and
the continuous-time frequency variable is ! D T , the DFT frequencies
correspond to continuous-time frequencies
2k
:
k D
NT
The DFT can therefore only be used to find points on the DTFT of the
windowed signal xw Œn of xŒn.
The operation of windowing involves multiplication in the discrete time
domain, which corresponds to continuous-time periodic convolution in the
DTFT frequency domain. The DTFT of the windowed signal is therefore
Z 
j! 1
Xw .e / D X.e j /W .e j.!  / /d;
2 
where W .e j! / is the frequency response of the window function. For a simple
rectangular window, the frequency response is as follows:
1
wr Œn

0.5
0
0 8
jWr .e j! /j

0
 0 
!
The DFT therefore effectively samples the DTFT of the signal convolved with
the frequency response of the window.

12
Example: Spectrum analysis of sinusoidal signals Suppose we have the
sinusoidal signal combination

xŒn D cos.=3n/ C 0:75 cos.2=3n/; 1 < n < 1:

Since the signal is infinite in duration, the DTFT cannot be computed


numerically. We therefore window the signal in order to make the duration
finite:

1
xŒn

0
−1
0 8

1
wr Œn

0.5

0
0 8

1
xw Œn

0
−1
0 8
n

The operation of windowing modifies the signal. This is reflected in the


discrete-time Fourier transform domain by a spreading of the frequency
components:

13
jX.e j! /j
0.5

0 2   2
 3 3
0 3 3

jWr .e j! /j

0 2   2
 3 3
0 3 3

jXw .e j! /j

0 2   2
 3 3
0 3 3

!
The operation of windowing therefore limits the ability of the Fourier
transform to resolve closely-spaced frequency components. When the DFT is
used for spectrum estimation, it effectively samples the spectrum of this
modified signal at the locations of the crosses indicated:
6
jXŒkj

0
0 1 2 3 4 5 6 7
k
Note that since k D 0 corresponds to ! D 0, there is a corresponding shift in
the sampled values.
In general, the elements of the N -point DFT of xw Œn contain N evenly-spaced
samples from the DTFT Xw .e j! /. These samples span an entire period of the
DTFT, and therefore correspond to frequencies at spacings of 2=N . We can
obtain samples with a closer spacing by performing more computation.

14
Suppose we form the zero-padded length M signal xM Œn as follows:
8
<xŒn 0nN 1
xM Œn D
:0 N  n  M 1:

The M -point DFT of this signal is


M
X1 N
X1
2 2
j kn j M kn
XM Œk D xM Œne M D xw Œne
nD0 nD0
1
X 2
j M kn
D xw Œne
nD 1

The sample Xp Œk can therefore be seen to correspond to the DTFT of the the
windowed signal xw Œn at frequency !k D 2k=M . Since M is chosen to be
larger than N , the transform values correspond to regular samples of Xw .e j! /
with a closer spacing of 2=M . The following figure shows the magnitude of
the DFT transform values for the 8-point signal shown previously, but
zero-padded to use a 32-point DFT:

1
xM Œn

0
−1

0 5 10 15 20 25 30
n
5
jXŒkj

0
0 5 10 15 20 25 30
k

Note that this process increases the density of the samples, but has no effect on
the resolution of the spectrum.
If W .e j! / is sharply peaked, and approximates a Dirac delta function at the

15
origin, then Xw .e j! /  X.e j! /. The values of the DFT then correspond quite
accurately to samples of the DTFT of xŒn. For a rectangular window, the
approximation improves as N increases:
1
wr Œn

0.5

0
0 32
jWr .e j! /j

32

0
 0 
jXw .e j! /j

0
 0 
!
The magnitude of the DFT of the windowed signal is

15
jXŒkj

10
5
0
0 5 10 15 20 25 30
k

which is clearly easier to interpret than for the case of the shorter signal. As
the window length tends to 1, the relationship becomes exact.
The rectangular window inherent in the DFT has the disadvantage that the peak
sidelobe of Wr .e j! / is high relative to the mainlobe. This limits the ability of
the DFT to resolve frequencies. Alternative windows may be used which have
preferred behaviour — the only requirement is that in the time domain the

16
window function is of finite duration. For example, the triangular window
1
wr Œn
0.5

0
0 32
jWr .e j! /j

0
 0 
jXw .e j! /j

0
 0 
!

leads to DFT samples with magnitude


10
jXŒkj

0
0 5 10 15 20 25 30
k

Here the sidelobes have been reduced at the cost of diminished resolution —
the mainlobe has become wider.
The method just described forms the basis for the periodogram spectrum
estimate. It is often used in practice on account of its perceived simplicity.
However, it has a poor statistical properties — model-based spectrum
estimates generally have higher resolution and more predictable performance.
Finally, note that the discrete samples of the spectrum are only a complete

17
representation if the sampling criterion is met. The samples therefore have to
be sufficiently closely spaced.

4 Fast Fourier transforms

The widespread application of the DFT to convolution and spectrum analysis


is due to the existence of fast algorithms for its implementation. The class of
methods are referred to as fast Fourier transforms (FFTs).
Consider a direct implementation of an 8-point DFT:
7
X
XŒk D xŒnW8k n ; k D 0; : : : ; 7:
nD0

If the factors W8k n have been calculated in advance (and perhaps stored in a
lookup table), then the calculation of XŒk for each value of k requires 8
complex multiplications and 7 complex additions. The 8-point DFT therefore
requires 8  8 multiplications and 8  7 additions. For an N-point DFT these
become N 2 and N.N 1/ respectively. If N D 1024, then approximately one
million complex multiplications and one million complex additions are
required.
The key to reducing the computational complexity lies in the observation that
the same values of xŒnW8k n are effectively calculated many times as the
computation proceeds — particularly if the transform is long.
The conventional decomposition involves decimation-in-time, where at each
stage a N-point transform is decomposed into two N=2-point transforms. That

18
is, XŒk can be written as
N=2 1 N=2 1
.2rC1/k
X X
XŒk D xŒ2rWN2rk C xŒ2r C 1WN
rD0 rD0
N=2 1 N=2 1
X X
D xŒ2r.WN2 /rk C WNk xŒ2r C 1.WN2 /rk :
rD0 rD0

Noting that WN2 D WN=2 this becomes


N=2 1 N=2 1
X X
rk
XŒk D xŒ2r.WN=2 / C WNk xŒ2r C 1.WN=2 /rk
rD0 rD0

D GŒk C WNk H Œk:

The original N-point DFT can therefore be expressed in terms of two


N=2-point DFTs.
The N=2-point transforms can again be decomposed, and the process repeated
until only 2-point transforms remain. In general this requires log2 N stages of
decomposition. Since each stage requires approximately N complex
multiplications, the complexity of the resulting algorithm is of the order of
N log2 N .
The difference between N 2 and N log2 N complex multiplications can
become considerable for large values of N . For example, if N D 2048 then
N 2 =.N log2 N /  200.
There are numerous variations of FFT algorithms, and all exploit the basic
redundancy in the computation of the DFT. In almost all cases an off-the-shelf
implementation of the FFT will be sufficient — there is seldom any reason to
implement a FFT yourself.

19

You might also like