Download as pdf or txt
Download as pdf or txt
You are on page 1of 87

Fourier Transform

1. Frequency analysis: a powerful tool

2. A tour of Fourier Transforms


3. Continuous Fourier Series (FS)
4. Discrete Fourier Series (DFS)
5. Discrete Fourier Transform (DFT)
6. Fast Fourier Transform (FFT)
Frequency Analysis
General Transform as problem-solving tool
  
F ( f )   f (t )e i 2 ft
dt or F ( )   f (t )e i t dt
 2 

f(t), F(f) :
Fourier Transform Pair  = 2f

analysis
time, t frequency, f
F
f(t) F(f) = F[f(t)]

synthesis
FT History 1
 Astronomic predictions by Babylonians/Egyptians likely via trigonometric sums.

 1669: Newton stumbles upon light spectra (specter = ghost) but fails to
recognise “frequency” concept (corpuscular theory of light, & no waves).

 18th century: two outstanding problems


 celestial bodies orbits: Lagrange, Euler & Clairaut approximate observation data
with linear combination of periodic functions; Clairaut,1754(!) first DFT formula.
 vibrating strings: Euler describes vibrating string motion by sinusoids (wave
equation). BUT peers’ consensus is that sum of sinusoids only represents smooth
curves. Big blow to utility of such sums for all but Fourier ...

 1807: Fourier presents his work on heat conduction  Fourier analysis born.
 Diffusion equation  series (infinite) of sines & cosines. Strong criticism by peers
blocks publication. Work published, 1822 (“Theorie Analytique de la chaleur”).
FT History 2
 19th / 20th century: two paths for Fourier analysis - Continuous & Discrete.

CONTINUOUS
 Fourier extends the analysis to arbitrary function (Fourier Transform).
 Dirichlet, Poisson, Riemann, Lebesgue address FS convergence.
 Other FT variants born from varied needs (ex.: Short Time FT - speech analysis).

DISCRETE: Fast calculation methods (FFT)


 1805 - Gauss, first usage of FFT (manuscript in Latin went unnoticed!!!
Published 1866).
 1965 - IBM’s Cooley & Tukey “rediscover” FFT algorithm (“An algorithm for
the machine calculation of complex Fourier series”).
 Other DFT variants for different applications (ex.: Warped DFT - filter design &
signal compression).
 FFT algorithm refined & modified for most computer platforms.
Fourier Analysis - Applications
• Telecommunication - GSM/cellular phones,
• Electronics/IT - most DSP-based applications,
• Entertainment - music, audio, multimedia,
• Accelerator control (tune measurement for beam steering/control),
• Imaging, image processing,
• Industry/research - X-ray spectrometry, chemical analysis (FT
spectrometry), PDE solution, radar design,
• Medical - (PET scanner, CAT scans & MRI interpretation for sleep
disorder & heart malfunction diagnosis,
• Speech analysis (voice activated “devices”, biometry, …).
Why Do We Need Frequency Domain?

Relatively easy
Problem in solution
Solution in
Frequency Space Frequency Space

A detour
Inverse Fourier
Fourier
Transform
Transform

Difficult solution
Original Problem Solution of Original
Problem
Time vs Frequency Domain

 Simply different view or representation to the same


signal.
Parseval's Theorem
 Mathematically, Parseval's theorem usually refers to the result that
the Fourier Transform is unitary: that the sum of the square of a
function is equal to the sum (or integral) of the square of its
transform.

 In physics and engineering, Parseval's theorem is often


written as

 Physically meaning: the power of the same signal should be the


same no matter it is represented in time domain or in frequency
domain.
Energy Signals vs Power Signals
 The terms signal energy and signal power are used to characterize a
signal. They are not actually measures of energy and power.
 The definition of signal energy and power refers to any signal x(t),
including signals that take on complex values.

The signal energy in the signal x(t) is E   | x(t ) |2 dt


1 T
The signal power in the signal x(t) is P  lim
T  2T 
T
| x(t ) |2 dt

 If 0 < E < ∞, then the signal x(t) is called an energy signal.


 However, there are signals where this condition is not satisfied. For
such signals we consider the power.
 If 0< P < ∞, then the signal x(t) is called an energy signal.
 Note that the power for an energy signal is zero (P=0) and that the
energy for a power signal is infinite (E= ∞).
 Some signals are neither energy nor power signals.
Energy Signals vs Power Signals
t
Example 1: Let us consider a signal x(t )  e u(t ) . Here u(t) is the step function:
The energy of the signal is 1


  1 1
E   | et u(t ) |2 dt   e2t dt   e 2t  0
 0 2 2 t
0 2 4 6

The signal x(t) is an energy signal. Since E is finite, the signal power P = 0.

 j0t
Example 2: Let us consider another periodic signal x(t )  Ae
2
Signal x(t) has a period T 0 , and it cannot be an energy signal.
0
The power of the signal is
1 T0 / 2 1 T0 / 2
 
jt 2
P | Ae | dt  A2dt  A2
T0 T0 / 2 T0 T0 / 2

Since P is finite, x(t) is a power signal and its energy is infinite.


Fourier Series (FS)
A periodic function s(t) satisfying Dirichlet’s conditions * can be expressed
as a Fourier series, with harmonically related sine/cosine terms.

 a0, ak, bk : Fourier coefficients.


k: harmonic number,
s(t)  a0   ak  cos (k ω t)  bk  sin(k ω t) T: period,  = 2/T
k 1
For all t but discontinuities

T
1 (signal average over a period, i.e. DC term &
a0    s(t)dt
T zero-frequency component.)
0
T
2
ak    s(t) cos(kω t) dt
T Note: {cos(kωt), sin(kωt) }k
0
form orthogonal base of
T
2 function space.
- bk    s(t) sin(kω t) dt
T
0
FS Convergence
Dirichlet conditions
(a) s(t) piecewise-continuous;

In any period: (b) s(t) piecewise-monotonic;


T
(c) s(t) absolutely integrable ,  s(t) dt  
0

Rate of convergence
T
Example:
if s(t) is discontinuous, then
square wave
|ak|<M/k for large k (M>0)

s(t)

(a) (b) (c)


FS analysis - 1
FS of odd* function: square wave.
1.5


square signal, sw(t)


1
T  2π  ω  1
0.5
π 2π 
1  
a0     dt   ( 1)dt  0
2π 
(zero average) 0

0 π 

0 2 4 6 8 10 t
-0.5
π 2π 
1  
ak     cos kt dt   cos kt dt  0 (odd function)
-1
π  
0 π  -1.5

π 2π 
1  
- bk     sinkt dt   sinkt dt  ... 
2
  1 cos kπ   * Even & Odd functions
π   k  π
0 π  s(x)

 4 Even :
 k  π , k odd

  s(-x) = s(x)
x
 0 , k even


s(x)

Odd :
4 4 4
sw(t)   sin t   sin 3  t   sin 5  t  ... s(-x) = -s(x) x
π 3π 5π
FS analysis - 2
Fourier spectrum
representations zk = (rk , k )

 bk rk rk = ak 2 + bk 2
s(t)   vk (t) k k = arctan(bk /ak )
k 0 ak

Rectangular Polar
vk = akcos(k t) - bksin(k t) vk = rk cos (k t + k)
rk
ak rK = amplitude, 4/π
All are zeros.
K = phase 4/3π

f1 3f1 5f1 f
f1 2f1 3f1 4f1 5f1 6f1 f fk=k /2 θk
-bk
f1 3f1 5f1 f
4/π

4/3π

f1 2f1 3f1 4f1 5f1 6f1 f


Fourier spectrum -π/2

of square-wave.
FS Synthesis
Periodic functions and signals may be expanded into a series of sine and
cosine functions

Example: Square wave reconstruction from spectral terms.


1.5

square signal, sw(t)


157
3
11
9 0.5

sw1 (t)
(t)
9(t)
5
7
3
11 --b-bkbkksin(kt)
sin(kt)
sin(kt)
sin(kt)
0
kkk1
11
-0.5

-1

-1.5
0 2 4 6 8 10
t

Convergence may be slow (~1/k) - ideally need infinite terms.


Practically, series truncated when remainder below computer tolerance
( error). BUT … Gibbs’ Phenomenon.
Gibbs phenomenon (overshooting)
1.5

Overshoot exist @ 1

square signal, sw(t)


each discontinuity 0.5

0
79
sw79 (t)   - bk  sin(kt) -0.5

k 1
-1

-1.5
0 2 4 6 8 10
t

• First observed by Michelson, 1898. Explained by Gibbs.


• Max overshoot pk-to-pk = 8.95% of discontinuity magnitude.
Just a minor annoyance.
• FS converges to (-1+1)/2 = 0 @ discontinuities, in this case.
FS Properties
Time Frequency
Homogeneity a·s(t) a·S(k)

Additivity s(t) + u(t) S(k)+U(k)

Linearity a·s(t) + b·u(t) a·S(k)+b·U(k)

Time reversal s(-t) S(-k)



Multiplication * s(t)·u(t)  S(k  m)U(m)
T m  
1
Convolution *   s(t  t )  u(t ) dt S(k)·U(k)
T
0
2π k t
Time shifting s(t t ) j
e T  S(k)
2π m t
j
Frequency shifting e T  s(t) S(k - m)
Discrete Fourier Series (DFS)
Band-limited signal s[n], period = N.
DFS generate periodic ck
DFS defined as: analysis with same signal period

2π k n Orthogonality in DFS:
1 N 1  j
ck   s[n] e
~ N
N 2π n(k-m)
n 0 N 1 j
1
~ ~  e N  δ k,m
Note: ck+N = ck  same period N N
n 0
i.e. time periodicity propagates to frequencies!

synthesis
2π k n N consecutive samples of s[n]
N1 j completely describe s in time
s[n]   ~ ck  e N
or frequency domains.
k 0

Synthesis: finite sum  band-limited s[n]


DFS analysis
s[n]
DFS of periodic discrete 1

1-Volt square-wave

-5 0 1 2 3 4 5 6 7 8 9 10 n
s[n]: period N, duty factor L/N 0 L N

1 1
 L ~
 , k  0,  N,  2N,... 0.6 0.6 ck 0.6 0.6
N

 0.24 0.24 0.24 0.24
 0.2
~
ck   π k (L 1)  π kL 
 j sin 
e N  N  0 1 2 3 4 5 6 7 8 9 10 k
  , otherwise
N π k
 sin 
  N  k 0.4
0.4
0.2 0.2

Discrete signals  periodic frequency spectra.


0 2 4 5 6 7 8 9 10 n
Compare to continuous rectangular function
-0.2 -0.2

-0.4 -0.4
Fourier Transform (FT)
• F() is computed from f(t) by the Fourier
Transform:

FT: F ( f )   f (t )e i 2 ft
dt


Inverse FT:
 1 
f (t )   F ( f )e i 2f t
df   F ( )e i t
d
 2 
Inverse Fourier Transform (FT)
• A non-periodic function can be represented as a sum of
sin’s and cos’s of (possibly) all frequencies:
1 
f ( x) 
2 
F ( )eix d
Euler’s Identity:
e  cos x  i sin x
ix eix  cos x  i sin x

• F() is the spectrum of the function f(x)


– The spectrum is how much of each frequency is present in
the function
– We’re talking about functions, not colors, but the idea is the
same
Example 1: Delta Function and Its Transform

f (t )   (t ) F( f )  1

 Fourier transform and inverse Fourier transform are qualitatively


the same, so knowing one direction gives you the other.
Example 2: Box Function and Its Transform

1 t1 sin f


f (t )   2 F( f )   sinc f
t1 f
0 2

f 
1.5
1.5

2
1.3
1.3
1.1
1.1
0.9
0.9
0.7
0.7
0.5
0.5
0.3
0.3
0.1
0.1
-0.1
-0.1
-0.3
-0.3
-0.5

f(x) F()
-0.5
Example 2: Box Function and Its Transform


F( f )   f ( x )e i 2 f x dt

1 / 2
 e i 2 f t dt Euler’s Identity:
1 / 2

1
1 / 2
ei x  cos x  i sin x
  e  i 2 f t
 i 2 f 1 / 2

 e i f  ei f 
1

 i 2 f

 cos(  f )  i sin(  f )   cos( f )  i sin( f ) 


1

 i 2 f
sin  f
  2i sin( f ) 
1

 i 2 f  f
Example 3: Cosine and Its Transform

f (t )  cos(0t )  cos(2 f 0t ) F ( f )   ( f  f 0 )   ( f  f 0 )
1
2
1.5

1

0.5

-1 1
-0.5

-1

-1.5

f(x) F()

FACT: If f(x) is even, so is F()


Example 4: Sine and Its Transform

F ( f )   ( f  f 0 )   ( f  f 0 )
1
f (t )  sin(0t )  sin(2 f 0t )
2i

1.5

1

0.5

-1
0

-0.5
1

-1
-
-1.5

f(x) F()

FACT: If f(x) is odd, so is F()


Example 4: Sine and Its Transform
- MATLAB Practice
0.5 Time domain
Sine wave
0

-0.5

0 0.2 0.4 0.6 0.8 1


Time [Sec.]

0.4 Freq. domain


0.3 Delta function
0.2 (Amplitude only)
0.1

-100 -50 0 50 100


Freq. [Hz]
0.4 Freq. domain
0.2
(Imaginary only)
0
-0.2
-0.4
-100 -50 0 50 100
Freq. [Hz]
Example 4: Constant Function and Its
Transform
f (t )  1 F( f )   ( f )

 The constant function only contains the 0 th frequency – it has no wiggles.

 It is the DC in the circuits.


Example 6: Gaussian and Its Transform
(the same)
t2
1  f2
f (t )  e 2
F( f ) 
1 
2
2
e
2

0.18 0.18

0.13 0.13

0.08 0.08

0.03 0.03

-0.02 -0.02

f(x) F()
Typical Fourier Transform Pairs

0.5

0.4 Gaussian
0.3
t2
1 
0.2
f (t )  e 2
0.1
2
0
0 5 10 15 20 25 30 35 40 45 50

6 Gaussian
5

4 f2
1 
3
F( f )  e 2
2

1
2
0
0 50 100 150 200 250
Time domain
0.14

0.12
0.1

0.08

0.06

0.04

0.02

-5 -4 -3 -2 -1 0 1 2 3 4 5
Time [Sec.]

-3
x 10
15 Real part
Imaginary part
10

-5

-60 -40 -20 0 20 40 60


Freq. [Hz]
Typical Fourier Transform Pairs

1.5

Sinc function
1

sin t
f (t )   sinc t
0.5

0 t
-0.5
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1

6 Square wave
5

4 
1 f 1
3
F( f )   2
0 f 1

2

1 2
0
-100 -50 0 50 100
Time domain
0.8

0.6

0.4

0.2

-0.2
-50 -40 -30 -20 -10 0 10 20 30 40 50
Time [Sec.]

-3
x 10
3
Absolute value
2 Real part
Imaginary part
1

-1

-2

-3
-100 -50 0 50 100
Freq. [Hz]
Typical Fourier Transform Pairs

0.8

0.6

0.4 Exponential
0.2

0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

30

25

20

15
Lorentzian
10

0
0 50 100 150 200 250
FACTS (Properties) of Fourier
Transform

 If f(x) is odd, so is F()


 If f(x) is even, so is F()

 If f(x) is real and even, F() is real and even.


 If f(x) is real and odd, F() is imaginary and odd.
 If f(x) is imaginary and even, F() is imaginary and even.
 If f(x) is imaginary and odd, F() is real and odd.
Continuous vs Discrete Sine Wave Signal
(Sampling and discretization)

f(t) = 5*sin (24t) f(t) = 5*sin (24t)


Amplitude = 5 Sampling rate fs = 256 samples/s
Frequency = 4 Hz Sampling duration = 1 sec
8 8

6 6

4 4

2 2

0 0

-2 -2

-4 -4

-6 -6

-8 -8
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

seconds seconds
The Discrete Fourier Transform (DFT)

• A transform takes one function (or signal)


and turns it into another function (or signal)
• The Discrete Fourier Transform pair:
N 1
Forward DFT: H n   hk e2ikn N

k 0
N 1
Inverse DFT: 1
(Reconstruction)
hk 
N
 n
H
n 0
e  2ikn N
DFS properties
Time Frequency

Homogeneity a·s[n] a·S(k)

Additivity s[n] + u[n] S(k)+U(k)

Linearity a·s[n] + b·u[n] a·S(k)+b·U(k)

Multiplication * 1 N1
s[n] ·u[n]   S(h)U(k - h)
N h 0
N1
Convolution *
 s[m] u[n  m] S(k)·U(k)
m 0
Time shifting s[n - m] j
2π k m
e T  S(k)
Frequency shifting j
2π h t S(k - h)
e T  s[n]
An undersampled signal
sin(28t), SR = 8.5 Hz
2

1.5

f(t) = sin (28t)


1

f0 = 8 Hz
0.5

0 Sampling rate fs = 8.5 Hz

-0.5

-1 Undersampled:
-1.5
fs < 2f0 = 16 Hz
-2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Nyquist Sampling Theorem
• Also known as the Nyquist Theorem, is a principle that
engineers follow in the digitization of analog signals
(analog-to-digital conversion, ADC);
• Samples of the analog waveform must be taken frequently
enough in order to result in a faithful reproduction of the
signal.

The Nyquist Theorem states that in order to adequately


reproduce a signal, it should be periodically sampled at
a rate that is 2X the highest frequency of the signal you
wish to record.
The Nyquist Frequency fN

fs > 2fN
This is 'Oversampling' that will take time fs < 2fN
and create a large digital data. This is ‘undersampling' that is not
enough to well represent the signal.

fs = 2fN
Nyquist Sampling Rate = The
minimum sample rate that
captures the "essence" of the
analog information.
Nyquist Frequency and Nyquist Rate

• The Nyquist frequency fN It is named after electronic


engineer Harry Nyquist.
• The Nyquist frequency fN is the highest frequency of a
signal or signal families;
• The Nyquist rate fs is twice the maximum component
frequency (fN) of the function being sampled.
• Nyquist frequency should not be confused with Nyquist
rate (fs), which is the minimum sampling rate that satisfies
the Nyquist sampling criterion for a given signal or family
of signals.
Nyquist Frequency and Nyquist Rate
- Example
• The Nyquist rate for sampling a sinusoid at frequency
0.6fs is 1.2fs, which means that at the fs rate it is being
undersampled.
• Thus, Nyquist rate is a property of a continuous-time
signal, whereas Nyquist frequency is a property of a
discrete-time system.
Undersampled Aliasing
(fs < 2fN)
DFT

-2fs -fs -fmax fmax fs 2fs

Time domain sampling In DFT frequency domain, it is represented as a


of a continuous signal periodic signal with a frequency band of fs.
with Ts = 1/fs If fs>2fmax , there is no aliasing.

IDFT

-2fs -fs -fmax fmax fs 2fs

aliasing
Reconstructed signal from
the undersampled discrete If fs < 2fmax , overlapping aliasing will occur, making
signal will be different the sampled discrete signal representation
different to the original continuous one.
Undersampled Aliasing
(fs < 2fN)
undersampled

-2fs -fs -fmax fmax fs 2fs

X Filter window

-2fs -fs -fmax fmax fs 2fs


=

Un-aliasing
Various filter windows:
o Blackman
-2fs -fs -fmax fmax fs 2fs o Hamming
o Hanning
One way to reduce the overlapping aliasing is to o Lanczos
use low-pass-filter to “cutoff” the overlapped high o Parzen
frequencies, but it will lose some high-frequency o Flat Top
components of the original continuous signal.
Various Window Functions
(apodization function, tapering function)
Hanning window ex1_2_windowfilters.m
 n 
w[n]  sin 2   0n N
Spatial Frequency Domain
1
N
0.8
Hamming window
Hanning
 2n 
0.6

w[n]  0.54  0.46 cos  0n N Hamming

 N  0.4 Kaiser
Lanczos
Kaiser window 0.2
Blackman
0
0 100 200 300 400 500
Samples

Spatial Domain
Lanczos window
 2n 
sin    1 0.8 Hanning
 2n  N 
w[n ]  sin c  1  0.6 Hamming
N     1
2n Kaiser
N  0.4
Lanczos
Blackman window 0.2 Blackman

0
1  2n    4n 
w[n]   0.5 cos   cos , 0  n  N -0.2
2  N  2  N  240 245 250 255 260 265 270
Bins
Practice Rules

Since a Fourier series can be written for any continuous-


time signal, the sampling and reconstruction processes for
any continuous-time signal is the same:

– Nyquist Rate fs ≥ 2fN to eliminate aliasing


– Oversampling to improve interpolation
– Ideal (low pass filter) Bandlimited interpolation
Fast Fourier Transform (FFT)

 The Fast Fourier Transform (FFT) is a very


efficient algorithm for performing a discrete
Fourier transform
 FFT principle first used by Gauss around 1805
 FFT algorithm published by Cooley & Tukey in
1965
 In 1969, the 2048 point analysis of a seismic
trace took 13 ½ hours. Using the FFT, the same
task on the same machine took 2.4 seconds.
Fast Fourier Transform (FFT)
• The DFT pair was given as
1 N1
IDFT x[n]   Xk e
N 1 j2  / Nkn
Xk    x[n]e  j2  / Nkn
N k 0
n0

• Baseline for computational complexity:


– Each DFT coefficient requires (say, X[1])
• N complex multiplications
• N-1 complex additions

– All N DFT coefficients require


• N2 complex multiplications
• N(N-1) complex additions
• Complexity in terms of real operations
• 4N2 real multiplications
• 2N(N-1) real additions
• Most fast methods are based on symmetry properties
– Conjugate symmetry e j2 / Nk Nn  e j2 / NkNe j2 / Nk n  ej2 / Nkn
– Periodicity in n and k e j 2 / N  kn  e j 2 / N k n N   e j 2 / N k  N n
Fast Fourier Transform (FFT)
• Makes use of both symmetry and periodicity
• Consider special case of N an integer power of 2
• Separate x[n] into two sequence of length N/2
– Even indexed samples in the first sequence

– Odd indexed samples in the other sequence


N 1 N 1 N 1
Xk    x[n]e  j2  / Nkn
  x[n]e  j2  / Nkn
  x[n]e  j2  / Nkn

n0 n even n odd

• Substitute variables n=2r for n even and n=2r+1 for odd WN  e j 2 / N 
N / 2 1 N / 2 1
Xk    x[2r]W 2rk
N   x[2r  1]W N
2r 1k

r 0 r 0
N / 2 1 N / 2 1
  x[2r]W  W  x[2r  1]W
r 0
rk
N/2
k
N
r 0
rk
N/2

 Gk   W Hk  k
N

• G[k] and H[k] are the N/2-point DFT’s of each subsequence


Fast Fourier Transform - FFT
 2 πiux
1 N1
F(u)   f ( x )e
Nx  0
N
u = 0, 1, 2, ..., N-1

O(N2) operations
 2 πiu2 x  2 πiu( 2 x  1)
1 N / 21 1 N / 2 1
F(u)   f (2x )e
N x 0
N
  f (2x  1)e
N x 0
N

even x odd x

1  1 N / 2 1  2 πi ux  2 πi u
1 N / 2 1  2 πi ux 

  f ( 2x )e N / 2  e N
 f ( 2x  1)e N / 2 
2 N / 2 x 0 N / 2 0
x 
 

Fourier Transform of Fourier Transform of


of N/2 even points of N/2 odd points
Even Odd
All sampling points sampling points sampling points

0 1 2 3 4 5 6 7 0 2 4 6 1 3 5 7

The Fourier transform of N inputs, can be performed as 2 Fourier Transforms of N/2


inputs each + one complex multiplication and addition for each value. Thus, if F(N) is the
computation complexity of FFT:

F(N)=F(N/2)+F(N/2)+O(N)  F(N)=N logN


1-D Fourier Transform
1. Audio Signal Analysis
2. Nuclear Magnetic Resonance (NMR) Signal
3. Radar Range Profile
MATLAB Practice - 1-D Fourier Transform

• Basic single frequency signals (sine wave)


• Square, triangular, impulse, Gaussian …
• Audio wave analysis
• Radar signal analysis (range profile)
MATLAB functions
• fft(), ifft()
• fliplr(), flipud(), fftshift(), ifftshift()
• matlab\audiovideo - Audio and Video support
• sound( )
• hamming( ), blackman( ), hann( )
MATLAB Practice - 1-D Fourier Transform
Example audio data (MAT files):
chirp - Frequency sweeps (1.6 sec, 8192 Hz)
gong - Gong (5.1 sec, 8192 Hz)
handel - Hallelujah chorus (8.9 sec, 8192 Hz)
laughter - Laughter from a crowd (6.4 sec, 8192 Hz)
splat - Chirp followed by a splat (1.2 sec, 8192 Hz)
train - Train whistle (1.5 sec, 8192 Hz)
clear
RAD = 180/pi;
load train; %% load in the default MATLAB example audio data
sound1 = y'; N1 = length(sound1); % samples of signal 1
Sound(sound1); %%% play the audio
%%%% default samples per second (Sampling frequency) Fs = 8192 Hz
time1 = [1:N1]/Fs;

sound1_FFT = fftshift(fft(sound1))/N1; % Fast Fouier Transform of signal 1


dF1 = Fs/(N1-1); % hertz per sample
f1 = [-Fs/2:dF1:Fs/2] - dF1 + (dF1/2)*mod(N1,2); % Fourier frequency domain, in hertz

figure(1);
Subplot(3,1,1); plot(time1,sound1); legend('train '); xlabel('Time [Sec.]'); axis tight;
subplot(3,1,2); plot(f1, abs(sound1_FFT)); legend('Amplitude-FFT');
xlabel('Freq.[Hz]'); ylabel('Amplitude'); axis tight;
Subplot(3,1,3); plot(f1, angle(sound1_FFT)*RAD); legend('Phase-FFT');
xlabel('Freq.[Hz]'); ylabel('Phase Angle [Deg.]'); axis tight;
MATLAB Practice - 1-D Fourier Transform
Sound Signal Frequency Analysis - Train
1
Train
0.5

-0.5

-1
0.2 0.4 0.6 0.8 1 1.2 1.4
Time [Sec.]

Amplitude-FFT
0.06
Amplitude

0.04

0.02

-4000 -3000 -2000 -1000 0 1000 2000 3000 4000


Freq.[Hz]
Phase Angle [Deg.]

Phase-FFT
100

-100

-4000 -3000 -2000 -1000 0 1000 2000 3000 4000


Freq.[Hz]
MATLAB Practice - 1-D Fourier Transform
Sound Signal Frequency Analysis - handel
ex1_1_audiosignal
handel
0.5

-0.5

1 2 3 4 5 6 7 8
Time [Sec.]
-3
x 10
10
Amplitude-FFT
8
Amplitude

6
4
2

-4000 -3000 -2000 -1000 0 1000 2000 3000 4000


Freq.[Hz]
Phase Angle [Deg.]

Phase-FFT
100

-100

20 40 60 80 100 120 140 160


Freq.[Hz]
MATLAB Practice - 1-D Fourier Transform
(Use LPF to filter out high frequency noise)
-3 Pro2_1_audio_LPF.m
x 10
10
Amplitude-FFT
8

6 Sound wave without noise


4

-4000 -3000 -2000 -1000 0 1000 2000 3000 4000


Freq. [Hz]

High freq. noise


0.5 generated in frequency
domain
0
-4000 -3000 -2000 -1000 0 1000 2000 3000 4000
Freq. [Hz]
MATLAB Practice - 1-D Fourier Transform
(Use LPF to filter out high frequency noise)
-3
x 10
Pro2_1_audio_LPF.m
10
8
6 Sound wave with added
4
2 high freq. noise
-4000 -3000 -2000 -1000 0 1000 2000 3000 4000
Freq. [Hz]
X
0.8
0.6 Hamming LPF filter in
0.4
0.2
freq. domain
-4000 -3000 -2000 -1000 0 1000 2000 3000 4000
Freq. [Hz]
=
-3
x 10
8
6 Sound wave with reduced
4
2 high freq. components
-4000 -3000 -2000 -1000 0 1000 2000 3000 4000
Freq. [Hz]

0.5
IFFT back to time domain.
0
Noise reduced but also
-0.5 lost some high freq.
1 2 3 4 5 6 7 8 components.
Time [Sec.]
MATLAB Practice - 1-D Fourier Transform
(Use LPF to filter out high frequency noise)

FFT
Time domain Audio Frequency Domain
Signal Signal

LPF

Inverse Fourier
Transform
LPF Filtered
Time domain Audio Frequency Domain
Signal Signal
1-D Fourier Transform
- Nuclear Magnetic Resonance (NMR) Signal
Multiple Frequency Signal FT Analysis
-Nuclear Magnetic Resonance (NMR) Spectroscopy
Pro1_2_NMR.m
t
• An: amplitude
3 
f (t )   An sin(2f n t )  e •
T2 n fn: Resonant freq.
n 1 • T2n: relaxation time
3
f1 = 80 Hz, T21 = 1 s
f1 f2 f3 2
f = 90 Hz, T2 = .5 s
2 2
1 f3 = 100 Hz, T23 = 0.25 s
80 Hz 90 Hz 100Hz 0
T21 T22 T23 -1

1.0 s 0.5 s 0.25 s -2 SR = 256 Hz

A1 A2 A3 -3
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

3.0 2.0 1.0 Time [Sec.]


120

100

80

fs = 256 Hz 60

40

20

0
0 20 40 60 80 100 120
Frequency [Hz]
Multiple Frequency Signal FT Analysis
-Nuclear Magnetic Resonance (NMR) Spectroscopy
(Undersampled Example) Pro1_2_NMR.m

3
f1 = 80 Hz, T21 = 1 s
2
f = 90 Hz, T2 = .5 s
2 2
1 f3 = 200 Hz, T23 = 0.25 s
Time-domain
0

NMR Signal -1

-2 SR = 256 Hz

-3
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

fs = 256 Hz Time [Sec.]


120

100

Frequency domain 80

60
NMR Signal 40

20

0
0 20 40 60 80 100 120

Frequency [Hz]
FFT of Free Induced Decay (FID)
(NMR Signal)

T2 = 0.5s
1

 t 
0
f t   sin2ft exp  
-1
f = 8 Hz
SR = 256 Hz
T2 = 0.5 s
 T 2 
-2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

70

60

50

F f 
40

30

20

10

0
0 20 40 60 80 100 120
FFT of Free Induced Decay (FID)
(NMR Signal)
2

 t 
1
f = 8 Hz
SR = 256 Hz f t   sin2ft exp  
T2 = 0.1 s T2
0

-1

-2
T2 = 0.1s
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

14

12

10

0
0 20 40 60 80 100 120
FFT of Free Induced Decay (FID)
(NMR Signal)
2

 t 
f t   sin2ft exp 
1

0 T2

-1 f = 8 Hz T2 = 2 s
SR = 256 Hz
T2 = 2 s
-2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

200

150

100

50

0
0 20 40 60 80 100 120
Effect of Changing Sample Rate fs

2
SR = 256 Hz
SR = 128 Hz
1
 t 
f t   sin2ft exp  
0
T2
-1 f = 8 Hz
T2 = 0.5 s T2 = 0.5 s
-2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

70 35

60 30

50 25

40 20

30 15

20 10

10 5

0 0
0 10 20 30 40 50 60
Effect of Changing Sample Rate fs
• Lowering the sample rate fs:
– Reduces the Nyquist frequency, which will reduces
the maximum measurable frequency
– Does not affect the frequency resolution

-2fs -fs -fmax fmax fs 2fs


fs2 < fs

-2fs2 -fs2 -fmax fmax fs2 2fs2


Effect of Changing Sampling Duration ST
2

1 ST = 2.0 s ST = 2s
ST = 1.0 s

0
vs
-1
ST = 1s
f = 8 Hz
T2 = .5 s

-2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2


70 F ( f )   f (t )ei 2 ft dt
60

50

40

30
Df  DT  1
20

10

0
0 2 4 6 8 10 12 14 16 18 20
1 1
Df  
• Reducing the sampling duration: DT ST
– Lowers the frequency resolution Df
– Does not affect the range of frequencies you can measure
Effect of Changing Sampling Duration ST

F ( f )   f (t )ei 2 ft dt

2

-1

-2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

200

150

100

50 f = 8 Hz
T2 = 2.0 s

0
0 2 4 6 8 10 12 14 16 18 20
Effect of Changing Sampling Duration ST
(Zero-padding)
1

zero-padding
0.5 ST = 0.5s singal
f = 100 Hz
T2 = 0.25s
0
fs = 256 Hz
-0.5

-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

F ( f )   f (t )ei 2 ft dt
Time[s]


25

20 zero-padding DFT
ST = 0.5s singal DFT
15

10

0 20 40 60 80 100 120
Freq.[Hz]

• Zero-padding to the time domain samplings:


– Increase the frequency resolution Df
– Does not affect the range of frequencies you can measure
Time Signal Interpolation by Zero-padding
25

20
Original time-
15
domain signal
10

-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 FFT
Time[s]

0.5 zero-padding before IDFT Frequency domain


0
zero-padding

-0.5
Frequency domain Zero padding
0 20 40 60 80 100 120
IFFT
25

20
Original time domain signal
15
Interpolated signal by zero-padding Interpolated Time
10
domain signal
5

-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time[s]
1-D Fourier Transform
- Radar Range Profile
1-D Fourier Transform - Radar Range Profile
 The tomographic images are generally formed by Transmission Tomography
by illuminating an object with signal (x-rays, microwaves, or ultrasound) and
measuring the energy that passes through the object to the other side.
 When microwave or ultrasound is used for imaging, the transmitted signal is
almost immeasurable because of large impedance discontinuities and other
attenuation losses.
 For this reason, most radar and medical ultrasonic imaging is done using
reflected signals, or Reflection Tomography, to construct a quantitative
cross-sectional image from reflection data.
 One nice aspect of Reflection Tomography, especially in comparison with
Transmission Tomography, is that transmission and reception are now done
from the same side, and it is not necessary to encircle the object with
transmitters and receivers for gathering the “projection” data.
 Examples:
o Ultrasound B-scan imaging
o Radar Imaging
o Radar-based microwave biomedical imaging
1-D Fourier Transform - Radar Range Profile
D > cT/2
x(t) h(t)
z (t )  x (t )  h(t )

Z( f )  X ( f )  H( f )
Time


Z ( f )   z (t )e i 2 ft dt


z(t) X ( f )   x (t )e i 2 ft dt


H ( f )   h(t )e i 2 ft dt
Down Range 

 An interesting class of linear operations is defined by the following


integral form

z(t )   x( )h(t   )d  x(t )  h(t )

1-D Fourier Transform - Radar Range Profile
2 Ri
ti 
c

 Under high-freq. approximation, the scattered field from the


target is assumed to be the coherent summation of the scattered
field from each point scatterer:
Ns Ns
j 4fRi
E ( f )   i  exp(  j 2fti )   i  exp(  )
i 1 i 1 c
 i : the reflectivity of the ith scatterer
f : the wave number of the transmitted wave
Ri : the distance between the radar and the ith point scatterer
1-D Fourier Transform - MATLAB Practice
(Radar Range Profile)
Ns Ns
E ( f )   i  exp(  j 2fti )   i  exp(  j 4fri / c)
i 1 i 1

r
 Range profile

Radar 2ri
transmitter ti 
c

Ns
f0 10 GHz
Bandwidth 3 GHz E ( f )   i  exp(  j 4fri / c)
i 1
(x1, y1), 1 (-0.3, 0.3), 1.8
(x2, y2), 2 (0, 0), 1.0 Range Profile:
(x3, y3), 3 (0.2, -0.2), 1.8
)   E ( f )  df  IFFT E ( f )
2r
(x4, y4), 4 (0.3, 0.3), 1.8  (t )   (
No. of Frequencies 128 c k
1-D Fourier Transform - MATLAB Practice
(Radar Range Profile)
ex1_3_rangeprofile.m
0.5

0
Scatters

-0.5
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Range[m]

6
|E(f)|
4
Radar scattering signal (freq.
2
domain, amplitude only)
9.4 9.6 9.8 10 10.2 10.4 10.6
Freq.[GHz]
IFFT
1.5

1
(r)
0.5 Time (range) domain
range profile
-2.6 -2.4 -2.2 -2 -1.8 -1.6 -1.4 -1.2 -1 -0.8 -0.6
Range[m]
MATLAB Practice - 1-D Fourier Transform
(Radar Range Profile)
clear ex1_3_rangeprofile.m
c = 3e8;
DR = 0.1; %% set range rsolution
Bandwidth = c/(2*DR);
f0 = 10e9; %% central frequency f0
NF = 128; %% number of frequencies through the band
df = Bandwidth / (NF-1);
f = [f0 - Bandwidth/2:df:f0 + Bandwidth/2];

R0 = -100; %% radar transmitter location along -x axis


X = [-0.3 0 0.2 0.3]; %% x coordinate of scatters
Y = [0.3 0 -0.2 0.3]; %% y coordinate of scatters
A = [1.8 1.0 1.8 1.8]; %% scatter strength
r = sqrt((X-R0).^2 + Y.^2); %% range between transmitter and scatter
t = 2*r/c; %% round trip time of radar wave from each scatter
E = 0;
for n = 1:length(A),
E = E + A(n)*exp(-j*2*pi*f*t(n));
end;

NFFT = 512; %% set FFT points (zero padding)


et = fftshift(ifft(E, NFFT))*NFFT/NF;
R = c/(2*df); %% convert time delay to range for each scatter
dr = R/NFFT*[-NFFT/2:NFFT/2-1];

figure(1);
subplot(3,1,1); plot(X, Y,'bo'); xlabel('Range[m]'); axis tight;
xlim([-1 1]);ylim([-0.5 0.5]);
subplot(3,1,2); plot(f/1e9,abs(E)); xlabel('Freq.[GHz]'); axis tight;
subplot(3,1,3); plot(dr,abs(et),'-'); xlabel('Range[m]'); axis tight;
xlim([-2.6 -0.6]);
Radar Range Profile- Resolution
D > cT/2
 The resolution of radar is its ability to
distinguish between targets in very
close range.

Time
 The range resolution of a radar
system can be simplified as :
cT c
Dr  
2 2B Down Range
o T: Time duration of pulse
D < cT/2
o B: bandwidth of radar signal
 Higher bandwidth leads to better
range resolution.
Time

Red part is the overlap between


two echoes from too close targets. Down Range
Sampling Time Duration ST and
Frequency Bandwidth
 1
F ( f )   f (t )e i 2 ft
dt ft  1 or Dt 
 Df
 To get a high resolution of the frequency data of a signal, one
needs to observe the signal in time domain for a long interval (Dt ->
long).
 If one observes the signal in the time domain for only a short
interval, then the (frequency data) Fourier transform of the signal is
more spreader (Df -> large).
 In other word, time and frequency domains are inversely related to
each other:
Dt Df

t f
Radar Range Profile Resolution
Ns
E ( f )   i  exp(  j 2fRi )
i 1

 The range resolution (in meter) can be approximated by

2 fx c c
Range resolution: ft  1 Dx  
c 2Df 2 B

B  Df  f max  f min : radar system bandwidth


Example:
For a radar system with central frequency fc = 10GHZ, bandwidth BW
= 3GHz, the range resolution is approximately:

c 3  108
Dr    0.05m
2Df 2  3  109
Visualizing the Fourier Image in MATLAB
 Consider a discrete function with limited time duration:
x(0), x(), x(2), … , x((N-1)) )
 The DFT is theoretically useful, but in practical computer
implementation, we actually follow transformation, called the finite
Fourier transform (FFT):
N 1 N 1
X k e j 2 / N kn
1
X k    x[n]e  j 2 / N kn IDFT: x[n ]  
N k 0
n 0

for k = 0, 1 , … , N-1
 We see that the X[k] are the samples of the continuous function
X(f) in frequency domain with
fk= k/(N), … , k = 0, 1, …, N-1
 A sampling interval of  in the t-domain implies a sampling interval of
1/(N in the frequency domain if we use the same N point DFT
without zero-padding.
 With zero-padding, say we actually use NFFT points in DFT, then

fk= k/(NFFT), … , k = 0, 1, …, NFFT - 1


Visualizing the Fourier Image in MATLAB
1 cycle

-N/2 0 N/2 N-1

fk= k/(N), … , k = 0, 1, …, N - 1

F F after fftshift
1 N/2 N N/2 N 1 N/2-1

After the fftshift, fk= k/(N), … , k = -N/2, …, -1, 0, 1, …, N/2 - 1


So, the negative frequencies in FT can be considered as the first
half of next frequency cycle.
Visualizing the Fourier Image in MATLAB
1.5

f(t) 0.5

0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Time(Sec.)

20

0
F = fft(f)
-20
-30 -20 -10 0 10 20 30
Freq.(Hz)

20
10

fftshift(F) 0
-10
-20
-30 -20 -10 0 10 20 30
Freq.(Hz)
Visualizing the Fourier Image in MATLAB
Fuv_shift = fftshift(Fuv);
Fuv Fuv after fftshift
1 N/2 N N/2 N 1 N/2-1
M/2

M/2 M
1

M M/2-1

Fuv Fuv after fftshift


How to Increase Frequency Domain Display
Resolution of Signals
 Suppose we have an 8 element sequence of data defined for both positive
and negative times as follows:
x-3 x-2 x-1 x0 x1 x2 x3 x4
 It can be fed into an FFT algorithm after it is rearranged to look like
x0 x1 x2 x3 x4 x-3 x-2 x-1
 If x-4 was also defined in the original sequence, we have three options:
o We can either ignore x-4, or ignore x4 and retain x-4 for the fifth from left
position in the above
o Or, use (x-4 + x4 )/2 for the 5th position by using the property of data
periodicity assumed by the FFT: the fifth element corresponds to both x4
and x-4 and they are supposed to be equal to each other.
 Now suppose we wish to double the display resolution in the frequency
domain; we must then zero-extend the time domain data as:
x0 x1 x2 x3 x4 0 0 0 0 0 0 0 x-4 x-3 x-2 x-1
 Note that we have now given separate identities to x4 and x-4, since they don’t
have to be equal to each other anymore. So if they are separately available,
they can be used as such.
Reverse way: how to Increase Time Domain
Display Resolution of Signals

f(x) |F()|
^
F

T x 
-1/2T 1/2T

f(x) |F()|
^
F

x 
T/2 -1/T 1/T

We can zero-pad the frequency


spectrum to interpolate the image

You might also like