0% found this document useful (0 votes)
149 views36 pages

Understanding the Discrete Fourier Transform

The document discusses the discrete Fourier transform (DFT), which decomposes a sequence of values into components of different frequencies. The DFT takes a discrete signal in the time domain and transforms it to a discrete frequency spectrum. It is calculated by taking the sum of the time domain signal multiplied by complex exponentials of different frequencies. The inverse DFT transforms the signal back from the frequency domain to the time domain. The DFT has applications in fields such as signal processing, image processing, and quantum mechanics.
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)
149 views36 pages

Understanding the Discrete Fourier Transform

The document discusses the discrete Fourier transform (DFT), which decomposes a sequence of values into components of different frequencies. The DFT takes a discrete signal in the time domain and transforms it to a discrete frequency spectrum. It is calculated by taking the sum of the time domain signal multiplied by complex exponentials of different frequencies. The inverse DFT transforms the signal back from the frequency domain to the time domain. The DFT has applications in fields such as signal processing, image processing, and quantum mechanics.
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

The Discrete

Fourier Transform
The Fourier Transform
• “The Fourier transform is a mathematical operation
with many applications in physics and engineering
that expresses a mathematical function of time as a
function of frequency, known as its frequency
spectrum.”

– from [Link]
The Fourier Transform
• “For instance, the transform of a musical chord made
up of pure notes (without overtones) expressed as
amplitude as a function of time, is a mathematical
representation of the amplitudes and phases of the
individual notes that make it up.”

– from [Link]
Amplitude & phase
• f(x) =  sin( x +  ) + 

–  is the amplitude
–  is the frequency
–  is the phase
–  is the DC offset
More generally
• f(x) = 1 sin(  1 x +  1 ) + 2 sin(  2 x +  2 ) + 
The Fourier Transform
• “The function of time is often called the time domain
representation, and the frequency spectrum the
frequency domain representation.”

– from [Link]
Applications
• differential equations
• geology
• image and signal processing
• optics
• quantum mechanics
• spectroscopy
REVIEW OF COMPLEX NUMBERS
Complex numbers
Complex numbers . . .

• extend the 1D number line to the 2D plane

• are numbers that can be put into the


rectangular form, a+bi where i2 = -1, and a and
b are real numbers.
Complex numbers
(rectangular form)

z  x  yi
Complex numbers
Complex numbers . . .
• a is the real part; b is the imaginary part

• If a is 0, then a+bi is purely imaginary; if b is 0,


then a+bi is a real number.

• originally called “fictitious” by Girolamo


Cardano in the 16th century
Complex arithmetic
• add/subtract

– add/subtract the real and imaginary parts


separately
Complex arithmetic
• complex conjugate

– often denoted as z * or z

– negate only the imaginary part


Complex arithmetic
• inverse

1 z z
  2
z zz a  b 2

where
z is a complex number
z bar is the length or magnitude of z
a is the real part
b is the imaginary part
Complex arithmetic
• multiplication (FOIL)

a  bi c  di   ac  bd   bc  ad  i


Complex arithmetic
• division

a  bi  ac  bd   bc  ad 
 2 
2   2 2 
i
c  di c d  c d 
a  bi c  di

c  di c  di

complex conjugate of denominator


Complex numbers z  x yi
(polar form)  r e i
 r cos   i r sin 
 r ei (  2 n )
where
r  z  x2  y2
 y
  arg  z   tan  
1

x
n is an integer and
x  r cos 
y  r sin 
exponential vs. trigonometric

e  cos x  i sin x
ix
(phasor form)

ix
e e
ix
sin x 
2i
ix
e e
ix
cos x 
2 Leonhard Euler 1707-1783
DFT
(DISCRETE FOURIER TRANSFORM)
DFT
• Say we have a sequence of N (possibly
complex) numbers, x0 … xN-1.

• The DFT produces a sequence of N (typically


complex) numbers, X0 … XN-1, via the
following:
N 1
X k   xn e
 i 2 k
N
n

n 0
DFT & IDFT
• The DFT (Discrete Fourier Transform) produces
a sequence of N (typically complex) numbers,
X0 … XN-1, via the following:
N 1
X k   xn e
 i 2 k
N
n

n 0
• The IDFT (Inverse DFT) is defined as follows:
N 1
1
X
 i 2 k
xk 
n
k e N

N k 0
Calculating the DFT
N 1

x e
 i 2 k
So how can we actually calculate X k 
n
n
N
?
n 0
Calculating the DFT
N 1
X k   xn e
 i 2 k n
• So how can we calculate N
?
n 0

• Let’s use this relationship: e  cos x  i sin x


ix

• Then
N 1
X k   xn cos 2 k
N n   i sin  2 k
N n 
n 0

• So what does this mean?


Interpretation of DFT
N 1
X k   xn cos 2 k
N n   xni sin  2 k
N n
n 0

Back to the polar form:

– r/N is the amplitude and  is the phase of a


sinusoid with frequency k/N into which xn is
decomposed
CALCULATING THE DFT USING
EXCEL
x_n X_0 X_ 1 X_ 2
N x b sin(b x) b2 sin(b2 x) 0.5*sin(b x) + 0.5*sin(b2 x) real imag real imag real imag
500 0 0.05 0.00 0.1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
1 0.05 0.10 0.07 0.07 0.00 0.07 0.00 0.07 0.00
2 0.10 0.20 0.15 0.15 0.00 0.15 0.00 0.15 -0.01
3 0.15 0.30 0.22 0.22 0.00 0.22 -0.01 0.22 -0.02
4 0.20 0.39 0.29 0.29 0.00 0.29 -0.01 0.29 -0.03
5 0.25 0.48 0.36 0.36 0.00 0.36 -0.02 0.36 -0.05
6 0.30 0.56 0.43 0.43 0.00 0.43 -0.03 0.43 -0.06
7 0.34 0.64 0.49 0.49 0.00 0.49 -0.04 0.49 -0.09
8 0.39 0.72 0.55 0.55 0.00 0.55 -0.06 0.54 -0.11
9 0.43 0.78 0.61 0.61 0.00 0.61 -0.07 0.59 -0.14
10 0.48 0.84 0.66 0.66 0.00 0.66 -0.08 0.64 -0.16
11 0.52 0.89 0.71 0.71 0.00 0.70 -0.10 0.68 -0.19
12 0.56 0.93 0.75 0.75 0.00 0.74 -0.11 0.71 -0.22
13 0.61 0.96 0.78 0.78 0.00 0.77 -0.13 0.74 -0.25
14 0.64 0.99 0.81 0.81 0.00 0.80 -0.14 0.76 -0.28
15 0.68 1.00 0.84 0.84 0.00 0.82 -0.16 0.78 -0.31
16 0.72 1.00 0.86 0.86 0.00 0.84 -0.17 0.79 -0.34
17 0.75 0.99 0.87 0.87 0.00 0.85 -0.18 0.79 -0.36
18 0.78 0.97 0.88 0.88 0.00 0.86 -0.20 0.79 -0.38
19 0.81 0.95 0.88 0.88 0.00 0.85 -0.21 0.78 -0.40
20 0.84 0.91 0.88 0.88 0.00 0.85 -0.22 0.77 -0.42
21 0.87 0.86 0.87 0.87 0.00 0.84 -0.23 0.75 -0.44
22 0.89 0.81 0.85 0.85 0.00 0.82 -0.23 0.72 -0.45
23 0.91 0.75 0.83 0.83 0.00 0.79 -0.24 0.69 -0.45
24 0.93 0.68 0.80 0.80 0.00 0.77 -0.24 0.66 -0.46
25 0.95 0.60 0.77 0.77 0.00 0.74 -0.24 0.63 -0.45
26 0.96 0.52 0.74 0.74 0.00 0.70 -0.24 0.59 -0.45
27 0.98 0.43 0.70 0.70 0.00 0.66 -0.23 0.55 -0.44
28 0.99 0.33 0.66 0.66 0.00 0.62 -0.23 0.50 -0.43
29 0.99 0.24 0.62 0.62 0.00 0.58 -0.22 0.46 -0.41
30 1.00 0.14 0.57 0.57 0.00 0.53 -0.21 0.42 -0.39
31 1.00 0.04 0.52 0.52 0.00 0.48 -0.20 0.37 -0.37
Check w/ matlab/octave
% see X0real = xn .* cos( -2*pi*n*0/N );
[Link] X0imag = xn .* sin ( -2*pi*n*0/N );
b/ref/[Link]
X1real = xn .* cos( -2*pi*n*1/N );
N = 256; % # of samples X1imag = xn .* sin ( -2*pi*n*1/N );
n = (0:N-1); % subscripts
b1 = 0.5; % freq 1 X2real = xn .* cos( -2*pi*n*2/N );
b2 = 2.5; % freq 2 X2imag = xn .* sin ( -2*pi*n*2/N );

xn = 0.5 * sin( b1*n ) + 0.2 * sin( b2*n ); X3real = xn .* cos( -2*pi*n*3/N );


X3imag = xn .* sin ( -2*pi*n*3/N );
plot( xn ); .
Xn = fft( xn ); .
plot( abs(Xn(1:N/2)) ); . Note: .* is element-wise (rather
than matrix) multiplication in
matlab.
Add random noise.
% see X0real = xn .* cos( -2*pi*n*0/N );
[Link] X0imag = xn .* sin ( -2*pi*n*0/N );
b/ref/[Link]
X1real = xn .* cos( -2*pi*n*1/N );
N = 256; % # of samples X1imag = xn .* sin ( -2*pi*n*1/N );
n = (0:N-1); % subscripts
b1 = 0.5; % freq 1 X2real = xn .* cos( -2*pi*n*2/N );
b2 = 2.5; % freq 2 X2imag = xn .* sin ( -2*pi*n*2/N );
r = randn( 1, N ); % noise
xn = 0.5 * sin( b1*n ) + 0.2 * sin( b2*n ) + X3real = xn .* cos( -2*pi*n*3/N );
0.5 * r;
X3imag = xn .* sin ( -2*pi*n*3/N );
plot( xn );
.
Xn = fft( xn );
.
plot( abs(Xn(1:N/2)) );
.
Signal without and with noise.
Signal with noise.
FFT of noisy signal (two major
components are still apparent).
Example of differences in phase.

xn = 0.5 * sin( b1*n ) + 0.2 * sin( b2*n )


xn = 0.5 * sin( b1*n – 0.5 ) + 0.2 * sin( b2*n )
Computational complexity:
DFT vs. FFT
• The DFT is O(N2) complex multiplications.
• In 1965, Cooley (IBM) and Tukey (Princeton)
described the FFT, a fast way (O(N log2 N)) to
compute the FT using digital computers.
– It was later discovered that Gauss described this
algorithm in 1805, and others had “discovered” it
as well before Cooley and Tukey.
– “With N = 106, for example, it is the difference
between, roughly, 30 seconds of CPU time and 2
weeks of CPU time on a microsecond cycle time
computer.” – from Numerical Recipes in C
Extending the DFT to 2D
(and higher)
• Let f(x,y) be a 2D set of sampled points. Then
the DFT of f is the following:
M 1 N 1
F u , v    f x, y  e
1  j 2 ux / M  vy / N 

MN x 0 y 0
M 1 N 1
f  x, y    F u , v  e  j 2 ux / M  vy / N 

u 0 v 0

• (Note that engineers often use i for amps


(current) so they use j for -1 instead.)
Extending the DFT to 2D
(and higher)
• In fact, the 2D DFT is separable so it can be
decomposed into a sequence of 1D DFTs.

M 1  N 1 
F u, v     f x, y  e
1 1
 e  j 2ux / N
N
 j 2vy / N


M x 0  y 0 

• And this can be generalized to higher and


higher dimensions as well.
The classical “Gibbs phenomenon”
• Visit
[Link]
• Hear it at
[Link]
uvY.

You might also like