0% found this document useful (0 votes)
108 views53 pages

The Discrete Fourier Transform

The document discusses the discrete Fourier transform (DFT). It begins by defining the continuous-time Fourier transform and discrete-time Fourier transform. It then introduces the DFT by choosing discrete frequency samples between 0 and 2π. This leads to the definition of the DFT as the summation of the time samples multiplied by complex exponentials with discrete frequencies. Examples are provided to calculate the DFT of simple sequences. It is shown that the DFT can be computed using a matrix equation. Finally, it discusses computing the DFT using MATLAB and provides examples of finding frequency spikes in the DFT of sampled signals.

Uploaded by

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

The Discrete Fourier Transform

The document discusses the discrete Fourier transform (DFT). It begins by defining the continuous-time Fourier transform and discrete-time Fourier transform. It then introduces the DFT by choosing discrete frequency samples between 0 and 2π. This leads to the definition of the DFT as the summation of the time samples multiplied by complex exponentials with discrete frequencies. Examples are provided to calculate the DFT of simple sequences. It is shown that the DFT can be computed using a matrix equation. Finally, it discusses computing the DFT using MATLAB and provides examples of finding frequency spikes in the DFT of sampled signals.

Uploaded by

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

The Discrete Fourier

Transform
The spectrum of a sampled function is given by


X s ()  X (e )  j
 x[n]e
n  
 jnT


  x[n]e
n 
 j n

where –p <  < p or 0 <  < 2p.


Since it impossible to carry-out the summation from
n=- to , let us consider a truncated version of x[n]:

~  x[n] (0  n < N  1),


x [ n]  
0 (elsewhere ).

The corresponding Fourier transform is



~ j
X (e )   x [n]e
~
n  
 j n

N 1
  x[n]e  j n
.
n 0

Because the series is truncated, the resultant


spectrum will exhibit Gibb’s phenomenon: there will
be ripples near the edges of the spectrum.
Now let us choose N frequency points from  = 0 to
2p:

k
  2p k  0, 1, ..., N  1.
N

When plugged into ej, these values correspond to


points along the unit circle.
As an example, if N = 4, we have

k
  2p k  0, 1, 2, 3.
4
  0, p2 ,p , 32p .

The values of ej are shown on the following slide.


Im

  p2

 p  0
Re
  2p

  32p
When we insert

k
  2p .
N
into

N 1
~ j
X (e )   x[n]e  j n

n 0

we get
N 1
~ j
  x[n]e
 j 2p nk
X [ k ]  X (e ) N
.
 2p k
N n 0

This function of k is the definition of the discrete


Fourier transform.

N 1
X [k ]  DFTx[n]   x[n]e
 j 2p nk
N
.
n 0
Example: Find the discrete Fourier transform of
x[n]=d[n], for N=4.

Solution: we have only four time samples and four


frequency samples. The values of the time samples
are 1 0 0 0 (for n=0, 1, 2, 3). Inserting these values
into the DFT definition, we have

3
X [k ]  DFTd [n]   d [n]e
 j 2p nk
4

n 0
 1e
 j 2p nk
4

n 0
 j 2p 0k
e 4
 1.

Note that this result is independent of k.

The result is consistent with the Fourier transform of


a delta function.
Example: Find the discrete Fourier transform of
x[n]=1, for N=4.

Solution: as before, we have only four time samples


and four frequency samples. The values of the time
samples are 1 1 1 1 (for n=0, 1, 2, 3). Inserting
these values into the DFT definition, we have

3
X [k ]  DFT1   1e
 j 2p nk
4

n 0
 1e  1e  1e  1e
 j 2p 0k
4
 j 2p 14k  j 2p 2k
4
 j 2p 3k
4

 j 2p k  j 2p 2k  j 2p 3k
 1 e 4
e 4
e 4
.

This result is dependent upon k.

 j 2p 0  j 2p 2 40   j 2p 3 40 
X (0)  1  e e 4
e
 1  1  1  1  4.

To perform the rest of the calculations, it is good to


have our circle of value of e-j2pnk/4
Im

nk  3,7 j  j 2p nk
e 4

nk  2, 6
1
Re
1
nk  0
nk  4, 8

nk  1,5,9 j
 j 2p 1  j 2p 2 41   j 2p 3 41 
X (1)  1  e 4
e e
 1  j  (1)  j  0.

 j 2p 2  j 2p 2 42   j 2p 3 42 
X ( 2)  1  e 4
e e
 1  (1)  1  (1)  0.

 j 2p 3  j 2p 2 43   j 2p 3 43 
X (3)  1  e 4
e e
 1  j  (1)  j  0.
The previous example suggests that the discrete
Fourier transform can be calculated using a matrix
equation:

 j 2p 0  j 2p 2 40   j 2p 3 40 
X (0)  1  e 4
e e .
 j 2p 1  j 2p 2 41   j 2p 3 41 
X (1)  1  e 4
e e .
 j 2p 2  j 2p 2 42   j 2p 3 42 
X (2)  1  e 4
e e .
 j 2p 3  j 2p 2 43   j 2p 3 43 
X (3)  1  e 4
e e .
 X [0] 1 1 1 1   x[0]
 X [1]  1  j  1 j   x[1] 
   .
 X [2] 1  1 1  1   x[2]
    
 X [3] 1 j  1  j   x[3]
For the previous examples we have

x[n]=d[n]

 X [0] 1 1 1 1  1 1


 X [1]  1  j  1 j  0 1
       .
 X [2] 1  1 1  1  0 1
      
 X [3] 1 j  1  j  0 1
x[n]=1

 X [0] 1 1 1 1  1 4


 X [1]  1  j  1 j  1 0
       .
 X [2] 1  1 1  1  1 0
      
 X [3] 1 j  1  j  1 0
In both cases the results are consistent with Fourier
transforms: the Fourier transform of an impulse is a
constant (white) spectrum, and the Fourier transform
of a constant is an impulse in frequency domain (just
a D.C. component).

Suppose that we found the DFT of x[n] = {1 –1 1 –1}.


 X [0] 1 1 1 1   1  0 
 X [1]  1  j  1 j   1 0
       .
 X [2] 1  1 1  1   1  4
      
 X [3] 1 j  1  j   1 0
We get the Fourier transform of a sinewave at half
the sampling frequency: k=2 (for N = 4) corresponds
to =p, or =s/2.

In general we have

k 
 .
N s
Example: Suppose we sample a 2 kHz sinewave at
8000 samples/second. If we perform a 1024-point
DFT, where are the spikes in the transform?

Solution:

k 2
  k  256.
1024 8
There will also be a spike at k=1024-256=768.
We can perform discrete Fourier transformations in
MATLAB using the function fft(). In MATLAB, as in
other software packages, the discrete Fourier
transform is implemented using an algorithm called
a fast Fourier transform. The previous examples
were done using MATLAB as will be shown on the
following slides.
x[n] = d[n]

>> x = [1 0 0 0];

>> X = fft(x)

X =

1 1 1 1
x[n] = 1

>> x = [1 1 1 1];
>> X = fft(x)

X =

4 0 0 0
x[n] = {1 –1 1 –1}

>> x = [1 -1 1 -1];
>> X = fft(x)

X =

0 0 4 0
x is a 2 kHz sinewave

>> n = 0:1023;
>> t = n/8000;
>> x = sin(2000*2*pi*t);
>> X = fft(x);
>> plot(n,abs(X));
Discrete Fourier Transform of Sampled Sinewave
600

500

400
X(k)

300

200

100

0
0 200 400 600 800 1000 1200
k
Example: Suppose we sample a sinewave at 16000
samples/second. After performing a 2048-point
DFT, we have frequency spikes at k=128 and k =
1920. Find the frequency of the sinewave.

Solution:

128 f
  f  1000 Hz.
2048 16000
Example: Suppose we sample the following signal
at 4000 samples/sec:

x(t )  cos1000pt  cos 500pt.

If we take a 512-point DFT, where are the frequency


spikes?

Solution: We find k for each of the two frequencies:


f1 = 500, f2 = 250.
k 500
  k  64.
512 4000

k 250
  k  32.
512 4000
We also get (alias) spikes at k = 448 and k = 480.
The Fast Fourier Transform
An N-point DFT takes N2 complex multiplications
and N2 complex additions. For large values of N, the
number of computations becomes very large. A
number of computationally-efficient algorithms have
been developed called fast Fourier transforms,
whose number of computations is far less than N2.

The key to the efficiency is in the exploitation of the


properties of e-j2pkn/N.
Let us look at the discrete Fourier transform for N=4:

 j 2p 0 40   j 2p 0 41   j 2p 0 42   j 2p 0 43 


 X [0] e e e e   x[0]
 X [1]    j 2p 140   j 2p 141   j 2p 142   j 2p 143  
 
   e e e e   x[1] .
 X [2] e   j 2p 2 40 
e
 j 2p 2 41 
e
 j 2p 2 42 
e
 j 2p 2 43  
 x[2]
    j 2p 340   j 2p 3 41   j 2p 3 42 

 j 2p 3 43   
 X [3] e e e e   x[3]
In order to simplify the notation, let W = e-j2p/N

 X [ 0] 
 W W 0 0
W W   x[0]
0 0

 X [1]   0 1 2 3  
   W W W W   x[1] 
.
 X [2] W 0 W 2 6
W W  x[2]
4

   0 9  
 W W W W   x[3]
3 6
 X [ 3]
Because of the periodicity of Wnk, we have

 X [ 0] 
 W W 0 0
W W   x[0]
0 0

 X [1]   0 1 2 3  
   W W W W   x[1] 
.
 X [2] W 0 W 2 2
W W  x[2]
0

   0 1  
 W W W W   x[3]
3 2
 X [ 3]
Now, suppose we rearrange the order of the x[n]
(time-domain) values:

 X [ 0] W  0
W W W   x[0]
0 0 0

 X [1]   0 2 1 3  
   W W W W   x[2]
.
 X [2] W 0 2
W W W  x[1] 
0 2

   0 1  
 X [3] W W W W   x[3]
2 3
This reordering lends itself to a repartitioning of the
matrices:

 X [ 0] W  0
W W W   x[0]
0 0 0

 X [1]   0 2 1 3  
   W W W W   x[2]
.
 X [2] W 0 2
W W W  x[1] 
0 2

   0 1  
 X [3] W W W W   x[3]
2 3
Adopting further notation for the partitioned matrix,
we have

X1   W11 W12  xeven 


X   W    ,
 2   21 W22  xodd 

where
W 0 W 0 
W11   0 2
 WN / 2 ,
W W 

The W11 matrix is a two-point DFT.


W 0 W 0 
W12   1 3 ,
W W 

The W12 matrix is a two-point DFT with the second


row (output) multiplied by W1. We denote this
operation by

W12  [1, W 1 ]WN / 2 .

The W21 matrix is the same as the W11 matrix—a


two-point DFT.
and

W 2 W 2 
W22   3 1 .
W W 

The W22 matrix is a two-point DFT with the first row


multiplied by W2, and the second row (output)
multiplied by W3:

W22  [W 2 , W 3 ]WN / 2 .
Xfirst half  WN/ 2 xeven [1,W 1 ]WN/ 2 xodd 
X   W x 2 3  ,
 second half   N/ 2 even [W ,W ]WN / 2 xodd 

Xfirst half
xeven N/2 +
[1, W1]
Xsecond half
xodd N/2 +
[W2, W3]
Further detail can be given to the block diagram:

+ X0
xeven N/2
+ X1
W1

+ X2
xodd N/2 W2
+ X3
W3
Finally,

x0 + + X0
x2 + + X1
W2
W1

x1 + + X2
W2
x3 + + X3
W2 W3
The resultant algorithm is called a [decimation in
time, radix-2] fast Fourier transform (FFT) and
uses fewer complex multiplications than a
conventional discrete Fourier transform (DFT). The
[radix-2] FFT algorithm consists of a number of
operations that look like this:
+
a
+
b

This operation is called a butterfly and consists of


two (complex) additions and two (complex)
multiplications.
This general computational idea can be extended
to higher-order DFT’s.
For example, an 8-point DFT can be constructed
from two 4-point DFT’s and four butterflies to
connect their outputs. A 16-point DFT can be
constructed from two 8-point DFT’s and eight
butterflies. The savings in number of computations
can be seen in the following table.
N DFT FFT
4 16 8
8 64 24
16 256 64
32 1024 160
64 4096 384

The number of complex multiplications to perform


an N-point DFT using the conventional (DFT)
algorithm and the FFT algorithm.
Exercise: Construct an 8-point [decimation-in-time,
radix-2] FFT from two 4-point FFT’s (already
constructed). Verify that the number of (complex)
multiplications is 24.
There are other types of fast Fourier transforms.
The FFT just developed was created by reordering
the time samples into even and odd parts. A second
type of FFT reorders the frequency samples into
even and odd parts. The first FFT algorithm is called
a decimation-in-time FFT. The second algorithm is
called a decimation-in-frequency FFT.
4-Point Decimation-in-Frequency FFT Algorithm

 X [0] W 0 W 0 W 0 W 0   x[0]
 X [2]  0 2 0 2  
  W W W W   x[1] 
.
 X [1]  W 0 W 1 3
W W  x[2]
2

   0 1  
  W W   x[3]
3 2
 X [3] W W
 X [0] W 0 W 0 W 0 W 0   x[0]
 X [2]  0 2 0 2  
  W W W W   x[1] 
,
 X [1]  W 0 W 1 3
W W  x[2]
2

   0 1  
  W W   x[3]
3 2
 X [3] W W

Xeven   WN / 2 WN / 2  x1 
X   W [1,W 1 ] W [W 2 ,W 3 ] x  .
 odd   N / 2 N /2  2 
x1 + N/2 X0,2

[1, W1]

x2 + N/2 X1,3
[W2, W3]

x0 + + X0
x1 + + X2
W2
W1

x2 + + X1
W2
x3 + + X3
W3 W2

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy