Title: The Discrete Fourier Transform
1The Discrete Fourier Transform
2The 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 http//en.wikipedia.org/wiki/Fourier_transfor
m
3The 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 http//en.wikipedia.org/wiki/Fourier_transfor
m
4Amplitude phase
- f(x) ? sin( ?x ? ) ?
- ? is the amplitude
- ? is the frequency
- ? is the phase
- ? is the DC offset
5More generally
- f(x) ?1 sin( ? 1 x ? 1 ) ?2 sin( ? 2 x ?
2 ) ?
6The Fourier Transform
- The function of time is often called the time
domain representation, and the frequency spectrum
the frequency domain representation. - from http//en.wikipedia.org/wiki/Fourier_transfor
m
7Applications
- differential equations
- geology
- image and signal processing
- optics
- quantum mechanics
- spectroscopy
8Review of complex numbers
9Complex numbers
- Complex numbers . . .
- extend the 1D number line to the 2D plane
- are numbers that can be put into the rectangular
form, abi where i2 -1, and a and b are real
numbers.
10Complex numbers(rectangular form)
11Complex numbers
- Complex numbers . . .
- a is the real part b is the imaginary part
- If a is 0, then abi is purely imaginary if b is
0, then abi is a real number. - originally called fictitious by Girolamo
Cardano in the 16th century
12Complex arithmetic
- add/subtract
- add/subtract the real and imaginary parts
separately
13Complex arithmetic
- complex conjugate
- often denoted as
- negate only the imaginary part
14Complex arithmetic
- inverse
- 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
15Complex arithmetic
16Complex arithmetic
complex conjugate of denominator
17Complex numbers(polar form)
18exponential vs. trigonometric
(phasor form)
Leonhard Euler 1707-1783
19DFT(Discrete Fourier Transform)
20DFT
- 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
21DFT IDFT
- The DFT (Discrete Fourier Transform) produces a
sequence of N (typically complex) numbers, X0
XN-1, via the following - The IDFT (Inverse DFT) is defined as follows
22Calculating the DFT
- So how can we actually calculate ?
23Calculating the DFT
- So how can we calculate ?
- Lets use this relationship
- Then
- So what does this mean?
24Interpretation of DFT
- 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
25Calculating the DFT using excel
26(No Transcript)
27Check w/ matlab/octave
- see http//www.mathworks.com/help/matlab/ref/fft
.html - N 256 of samples
- n (0N-1) subscripts
- b1 0.5 freq 1
- b2 2.5 freq 2
- xn 0.5 sin( b1n ) 0.2 sin( b2n )
- plot( xn )
- Xn fft( xn )
- plot( abs(Xn(1N/2)) )
- X0real xn . cos( -2pin0/N )
- X0imag xn . sin ( -2pin0/N )
- X1real xn . cos( -2pin1/N )
- X1imag xn . sin ( -2pin1/N )
- X2real xn . cos( -2pin2/N )
- X2imag xn . sin ( -2pin2/N )
- X3real xn . cos( -2pin3/N )
- X3imag xn . sin ( -2pin3/N )
- .
- .
- .
Note . is element-wise (rather than matrix)
multiplication in matlab.
28(No Transcript)
29Add random noise.
- see http//www.mathworks.com/help/matlab/ref/fft
.html - N 256 of samples
- n (0N-1) subscripts
- b1 0.5 freq 1
- b2 2.5 freq 2
- r randn( 1, N ) noise
- xn 0.5 sin( b1n ) 0.2 sin( b2n ) 0.5
r - plot( xn )
- Xn fft( xn )
- plot( abs(Xn(1N/2)) )
- X0real xn . cos( -2pin0/N )
- X0imag xn . sin ( -2pin0/N )
- X1real xn . cos( -2pin1/N )
- X1imag xn . sin ( -2pin1/N )
- X2real xn . cos( -2pin2/N )
- X2imag xn . sin ( -2pin2/N )
- X3real xn . cos( -2pin3/N )
- X3imag xn . sin ( -2pin3/N )
- .
- .
- .
30Signal without and with noise.
31Signal with noise. FFT of noisy signal (two major
components are still apparent).
32Example of differences in phase. xn 0.5 sin(
b1n ) 0.2 sin( b2n ) xn 0.5
sin( b1n 0.5 ) 0.2 sin( b2n )
33Computational complexityDFT 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
34Extending 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 - (Note that engineers often use i for amps
(current) so they use j for ?-1 instead.)
35Extending the DFT to 2D(and higher)
- In fact, the 2D DFT is separable so it can be
decomposed into a sequence of 1D DFTs. - And this can be generalized to higher and higher
dimensions as well.
36The classical Gibbs phenomenon
- Visit http//en.wikipedia.org/wiki/Square_wave.
- Hear it at http//www.youtube.com/watch?vuIuJTWS2
uvY.