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

DFT PDF

gg

Uploaded by

Manu Chakkingal
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
210 views

DFT PDF

gg

Uploaded by

Manu Chakkingal
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Lecture 7 - The Discrete Fourier Transform

7.1 The DFT


The Discrete Fourier Transform (DFT) is the equivalent of the continuous Fourier Transform for signals known only at instants separated by sample times (i.e. a nite sequence of data). Let be the continuous signal which is the source of the data. Let samples 10  . be denoted  !"$#$#$#%&'( #$#$#) The Fourier Transform of the original signal, , would be

4365798

@BA

CGIH"PDQ D F E C A

We could regard each sample &' as an impulse having area R&S . Then, since the integrand exists only at the sample points:

T3657U8 8

@WVYX a C `bYc CGeHPfQ E d 10 VYX ghE CGiqp  hE CGIHrcsp #$# # p &'hE CGIHtcsp # #$# rE CGeH Ca`bYc
ie.

43657u8

X v Ca` txwyi

&'hE CGIHtc

We could in principle evaluate this for any 5 , but with only data points to start with, only nal outputs will be signicant. You may remember that the continuous Fourier transform could be evaluated 0 over a nite interval (usually the fundamental period d ) rather than from to 82

if the waveform was periodic. Similarly, since there are only a nite number of input data points, the DFT treats the data as if it were periodic (i.e. to 10 0 ! r is the same as  to r .) Hence the sequence shown below in Fig. 7.1(a) is considered to be one period of the periodic sequence in plot (b).
(a) 1 0.8 0.6 0.4 0.2 0

10

11

(b) 1 0.8 0.6 0.4 0.2 0

10

15

20

25

30

Figure 7.1: (a) Sequence of

8

samples. (b) implicit periodicity in DFT.

Since the operation treats the data as if it were periodic, we evaluate the ` DFT equation for the fundamental frequency (one cycle per sequence, X c Hz, X c rad/sec.) and its harmonics (not forgetting the d.c. component (or average) at 58 ). i.e. set 58 or, in general

!r

!"

!$#$# #

!"

$# #$#

!"

10

C G6dg e f t %  8 &'hE  twyi


83

X v Ca`

8 ih

r

 jkk kk kl

is the Discrete Fourier Transform of the sequence &' .

We may write this equation in matrix form as:

2 g 2   !" 2 0 
. . .

m nn nn n o

jkk

 8 lk 

kk  kk  p
. . .

p pvq

 pts p u

 p q r p u r p w r

#$#$# #$#$#p #$#$#p #$#$#p p

where p

 p X Ca` p X C p X C q #$#$# 0 8xyz{ 3'!"}| and p 8p X etc. ~ 8 .

m nn Ca` nn X C nn X C q n o X jkk kk kl

g   !" 10
. . .

m nn nn n  o

DFT example
Let the continuous signal be

0 d u8 "  " p ! 6(!r)  p y )


dc 1Hz 2Hz

10 8 6 4 2 0 2 4 0 1 2 3 4 5 6 7 8 9 10

Figure 7.2: Example signal for DFT. Let us sample at 4 times per second (ie. values of the discrete samples are given by:

= 4Hz) from 8r to 8

. The

0 d p &'%8t p !6S &  6 {&


84

by putting 8r&'8

t s

i.e.

8t ,  %8 , !"8t , %8 2 v q

Therefore

%  8 0 3  3 0

0 C G" f t 8 v q &'dE  &'e 3' f t i txwyi 0 0   m nn kjlk mn kjlk m nn g n 6 !  0   8 3 03 o o   " !  r  ! o 0 3  3 

jkkl 2

m nn kjlk g     2  2   o 8  " !   2  

The magnitude of the DFT coefcients is shown below in Fig. 7.3.


20

15 |F[n]|

10

1 f (Hz)

Figure 7.3: DFT of four point sequence.

Inverse Discrete Fourier Transform


The inverse transform of

ft %  8 &'dE CGdeg twyi


85

X v Ca`

is

i.e. the inverse matrix is ric) matrix.

X a C `  v 2 ft R&'%8 hE G de f wyi


times the complex conjugate of the original (symmet-

Note that the  coefcients are complex. We can assume that the R&' values are real (this is the simplest case; there are situations (e.g. radar) in which two inputs, at each & , are treated as a complex pair, since they are the outputs from  o and  o demodulators). In the process of taking the inverse transform the terms  and  (reX member that the spectrum is symmetrical about ) combine to produce ! frequency components, only one of which is considered toX be valid (the one at the ; the higher frequency Hz where lower of the two frequencies, X B c component is at an aliasing frequency ( )).

2 0

From the inverse transform formula, the contribution to &' of is:

and

2 0

 2 e f tp 2 10 hE G de VYX C f b4t" f &'%8 hE G dg


For all &' real 

(7.2)

2 0

%8

X v Ca` twyi

V X &'hE CGde C f bt

But

C Gde VX C f bt 8 E %8 2

i.e.

2 0

1 for all &

C G t E 

G de t 8E 6 G dg e f t E6

(i.e. the complex conjugate)

86

Substituting into the Equation for

f  &' above gives,  2 eg f f tr t p 2 FE CG deg f R&'%8 d E G d


ie.

since

E G t 8

2 0 2 ! ! " ! " f &'8 ' & T & %"  


or

2 ! 2 ! " f &'%8  &' p6 d 2 8  ,  "8 2 R&' (i.e. sum of all samples) and the R&' is i ' & 8 X ` "8 average of &'8 d.c. compo f X c
Hz, of magnitude

i.e. a sampled sinewave at For the special case of 2 contribution of g to nent.

2 X  #

Interpretation of example
1. 2.

2 2

g8r!6

implies a d.c. value of

` 2 g%8 i r 8  s

(as expected)

0 2  8 3   2 { 8  8 8r! X s
i.e.

implies a fundamental component of peak amplitude  2  8 0  o with phase given by

! $

!"

&'

0  o 8t!u &  ! 0

(as expected)

3.

!"%8r!

component

X 8

no other

component here) and this implies a

 2 e t 8  2 R!rdE G t 8  {& &'%8 !"hE G d


since h{&i8t for all & 87

(as expected)

6 5 4 |F[n]| 3 2 1 0 0 1 f (Hz) 2 3 sqrt(2) 3/sqrt(2)

Figure 7.4: DFT of four point signal. Thus, the conventional way of displaying a spectrum is not as shown in Fig. 7.3 but as shown in Fig. 7.4 (obviously, the information content is the same): In typical applications, is much greater than ; for example, for 8 2 0 0 ! ,  has ! components, but  ! are the complex conjugates of 6  , i( ` to `fi ) `e` as complete a.c. comleaving `f ) i as the d.c. component, `fi ) ponents and frequency

` `fi s 8

` ) X .

as the cosine-only component at the highest distinguishable

s{

sq

Most computer programmes evaluate ) X (or )X for the power spectral den sity) which gives the correct shape for the spectrum, except for the values at X 8 and .

7.2 Discrete Fourier Transform Errors


To what degree does the DFT approximate the Fourier transform of the function underlying the data? Clearly the DFT is only an approximation since it provides only for a nite set of frequencies. But how correct are these discrete values themselves? There are two main types of DFT errors: aliasing and leakage:

88

7.2.1 Aliasing
This is another manifestation of the phenomenon which we have now encountered several times. If the initial samples are not sufciently closely spaced to represent high-frequency components present in the underlying function, then the DFT values will be corrupted by aliasing. As before, the solution is either to increase the sampling rate (if possible) or to pre-lter the signal in order to minimise its highfrequency spectral content.

7.2.2 Leakage
Recall that the continuous Fourier transform of a periodic waveform requires the p or over an integer number integration to be performed over the interval - to of cycles of the waveform. If we attempt to complete the DFT over a non-integer number of cycles of the input signal, then we might expect the transform to be corrupted in some way. This is indeed the case, as will now be shown. Consider the case of an input signal which is a sinusoid with a fractional num X ber of cycles in the data samples. The DFT for this case (for 8 to 8 ) is shown below in 7.5.
8

6 |F[n]|

4 freq

Figure 7.5: Leakage. We might have expected the DFT to give an output at just the quantised frequen89

cies either side of the true frequency. This certainly does happen but we also nd non-zero outputs at all other frequencies. This smearing effect, which is known as leakage, arises because we are effectively calculating the Fourier series for the waveform in Fig. 7.6, which has major discontinuities, hence other frequency components.
1

0.5

0.5

10

15

20

25

30

35

40

45

50

Figure 7.6: Leakage. The repeating waveform has discontinuities. Most sequences of real data are much more complicated than the sinusoidal sequences that we have so far considered and so it will not be possible to avoid introducing discontinuities when using a nite number of points from the sequence in order to calculate the DFT. The solution is to use one of the window functions which we encountered in the design of FIR lters (e.g. the Hamming or Hanning windows). These window functions taper the samples towards zero values at both endpoints, and so there is no discontinuity (or very little, in the case of the Hanning window) with a hypothetical next period. Hence the leakage of spectral content away from its correct location is much reduced, as in Fig 7.7.
(a) 7 6 5 4 3 2 1 0 0 2 4 6 8 1 0 3 2 5 4 (b)

Figure 7.7: Leakage is reduced using a Hanning window.

90

7.3 The Fast Fourier Transform


The time taken to evaluate a DFT on a digital computer depends principally on the number of multiplications involved, since these are the slowest operations. With the DFT, this number is directly related to (matrix multiplication of a vector), where is the length of the transform. For most problems, is chosen to be at least 256 in order to get a reasonable approximation for the spectrum of the sequence under consideration hence computational speed becomes a major consideration. Highly efcient computer algorithms for estimating Discrete Fourier Transforms have been developed since the mid-60s. These are known as Fast Fourier Transform (FFT) algorithms and they rely on the fact that the standard DFT involves a lot of redundant calculations:

Re-writing

 8 twyi

X v Ca`

&'hE CG de f t t

as

%  8 &'dp X f t txwyi

X v Ca`

it is easy to realise that the same values of p X f are calculated many times as the computation proceeds. Firstly, the integer product & repeats for different com t binations of & and ; secondly, p X f is a periodic function with only distinct values. For example, consider of 2)

8W

(the FFT is simplest by far if

is an integral power

0  3 `  C G C  G d p 8tE 8 E s 8 t 8 a say # ! 0 0 0 0 Then 8 3 q8 3Si8 s 8  0 8 u 83 S783S8W


From the above, it can be seen that:

~ 8 

91

pt s p p u pv
Also, if

0 8 0 p i 8 0 p ` 8 0 p 8 pv q p q 8t q 8 s q 8t q

&

falls outside the range 0-7, we still get one of the above values:

eg. if

8t

and &i8r

7.3.1 Decimation-in-time algorithm

Let us begin by splitting the single summation over samples into 2 summations, X each with samples, one for & even and the other for & odd. t tCa ` for & odd and write: Substitute 8 for & even and 8

e a C ` f p v V  `b 2 R!dp X ! p  d p X f %8 y wyi w i e a C ` v


Note that

C G de f  f V f b  C G d e 8 E W p X t 8 E 8rp e f e a C ` v 2

Therefore

e a C ` e f p v 2 %8 R!dp ! p  d p e f p X y wyi w i


ie.

Thus the -point DFT  can be obtained from two -point transforms, one on even input data,  , and one on odd input data,  . Although the fre X quency index ranges over values, only values of  and  need to be X computed since  and  are periodic in with period . For example, for

%  8t  p p Xi 

8W

: 92

2 2 2 2 2 2 2 2

even input data "!"d6 odd input data 

"8t 8t  R!r8tR!" 8t  g8t Rr8t  "8tR!" Rr8t 

p p i p p ` p p p pr q p pt s p p p p u p pv

d dRr"

g   !"  g8tg  8t  !"8t!" 8t  0

i 0 p ` 0 p 0 p prq

g   !" 

This is shown graphically on the ow graph of Fig 7.8:


f[0] f[2] f[4] f[6] f[1] f[3] f[5] f[7] G[0] N/2 point DFT G[3] H[0] N/2 point DFT H[3] F[0]

F[7]

Figure 7.8: FFT ow graph 1. Assuming than is a power of ! , we can repeat the above process on the two X X -point transforms, breaking them down to -point transforms, etc #$#$# , until we s , only one further stage is needed come down to ! -point transforms. For 81 (i.e. there are stages, where 8!r ), as shown below in Fig 7.9. Thus the FFT is computed by dividing up, or decimating, the sample sequence &' into sub-sequences until only ! -point DFTs remain. Since it is the input, or time, samples which are divided up, this algorithm is known as the decimationin-time (DIT) algorithm. (An equivalent algorithm exists for which the output, or frequency, points are sub-divided the decimation-in-frequency algorithm.) The basic computation at the heart of the FFT is known as the buttery because of its criss-cross appearance. For the DIT FFT algorithm, the buttery computation is of the form of Fig 7.10 93

f[0] f[4] f[2] f[6] f[1] f[5] f[3] f[7]

N/4 point DFT N/4 point DFT N/4 point DFT N/4 point DFT

F[0]

F[7]

Figure 7.9: FFT ow graph 2.

p pBX p p X 0 p X 0 p X B
Figure 7.10: Buttery operation in FFT.

where and are complex numbers. Thus a buttery computation requires one complex multiplication and 2 complex additions. Note also, that the input samples are bit-reversed (see table below) because at each stage of decimation the sequence input samples is separated into even- and odd- indexed samples. (NB: the bit-reversal algorithm only applies if

is an integral power of ! ).

94

Index 0 1 2 3 4 5 6 7

(&

Binary Bit-reversed Bit-reversed representation Binary index 000 000 0 001 100 4 010 010 2 011 110 6 100 001 1 101 101 5 110 011 3 111 111 7

7.3.2 Computational speed of FFT


complex multiplications. At each stage of the FFT (i.e. The DFT requires X each halving) complex multiplications are required to combine the results of the previous stage. Since there are ff stages, the number of complex mul tiplications required to evaluate an -point DFT with the FFT is approximately e

i because multiplications by factors such as p X , p X |e !f (approximately e p X and pX are really just complex additions and subtractions).
32 256 1,024

(DFT) 1,024 65,536 1,048,576

(FFT) saving 80 92 1,024 98 5,120 99.5

7.3.3 Practical considerations


If is not a power of ! , there are 2 strategies available to complete an FFT.

-point

1. take advantage of such factors as possesses. For example, if is divisi ble by (e.g. 8 ), the nal decimation stage would include a -point transform.

95

2. pack the data with zeroes; e.g. include 16 zeroes with the 48 data points (for 8v ) and compute a 6 -point FFT. (However, you should again be wary of abrupt transitions between the trailing (or leading) edge of the data and the following (or preceding) zeroes; a better approach might be to pack the data with more realistic dummy values).

96

You might also like