Top Banner
Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform
60

Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

Dec 18, 2015

Download

Documents

Spencer Berry
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

Environmental Data Analysis with MatLab

Lecture 11:

Lessons Learned from the Fourier Transform

Page 2: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

Lecture 01 Using MatLabLecture 02 Looking At DataLecture 03 Probability and Measurement Error Lecture 04 Multivariate DistributionsLecture 05 Linear ModelsLecture 06 The Principle of Least SquaresLecture 07 Prior InformationLecture 08 Solving Generalized Least Squares ProblemsLecture 09 Fourier SeriesLecture 10 Complex Fourier SeriesLecture 11 Lessons Learned from the Fourier TransformLecture 12 Power SpectraLecture 13 Filter Theory Lecture 14 Applications of Filters Lecture 15 Factor Analysis Lecture 16 Orthogonal functions Lecture 17 Covariance and AutocorrelationLecture 18 Cross-correlationLecture 19 Smoothing, Correlation and SpectraLecture 20 Coherence; Tapering and Spectral Analysis Lecture 21 InterpolationLecture 22 Hypothesis testing Lecture 23 Hypothesis Testing continued; F-TestsLecture 24 Confidence Limits of Spectra, Bootstraps

SYLLABUS

Page 3: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

purpose of the lecture

understand some of the properties of the

Discrete Fourier Transform

Page 4: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

from last week …

time series = sum of sines and cosines

rememberexp(iωt) = cos(ωt) + i sin(ωt)

k

Page 5: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

time series

from last week …

Discrete Fourier Transform of a time series

coefficients

power spectral density = 2

Page 6: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

di

ti Δt

time series

Page 7: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

di

ti Δta time series is a discrete representation of a

continuous function

continuous function

Page 8: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

d(t)

t

continuous function

What happens when to the Discrete Fourier Transform when we switch from discrete to continuous?

Page 9: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

Discrete Fourier Transform

Fourier Transform

turns into

Page 10: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

note the use of the tilde to distinguish a the Fourier Transform from the function itself.

The two functions are different!

Fourier Transform

Page 11: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

function of timefunction of frequency

Fourier Transform

power spectral density = 2

Page 12: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

function of time function of frequency

the inverse of the Fourier Transform is

Page 13: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

t

recall that an integral can be approximated by a summation

integral = area under curve =

S area of rectangle = S width × height = Δt Si f(ti)

f(t)f(ti)

Δtti

Page 14: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

then if we use N rectangles

each of width Δt

and

each of height d(tk) exp(-iωtk)then the Fourier Transform becomes

provided that d(t) is “transient”

zero outside of the interval (0,tmax)

Page 15: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

so except for a scaling factor ofΔt

the Discrete Fourier Transform is the discrete version of the Fourier Transform of a

transient function, d(t)scaling factor

Page 16: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

similarlythe Fourier Series is an approximation of

the Inverse Fourier Transform

Inverse Fourier Transform Fourier Series

(up to an overall scaling of Δω)

Page 17: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

Fourier Transform

in some ways

integrals are easier to work with than

summations

Page 18: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

Property 1

the Fourier Transform of a Normal curve with variance σt2

is a Normal curve with variance σω2 =σt-2

Page 19: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

let a2= ½σt-2

[cos(ωt ) + i sin(ωt )] dtcos(ωt ) dt + i sin(ωt ) dt

symmetric about zero antisymmetric about zeroso integral zero

Normal curve with variance a½ -2 = σt2

Page 20: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

look up in table of integrals

Normal curve with variance 2a2 = σt-2

Page 21: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

time series with broad features

Fourier Transform with mostly low frequencies

power spectral density with mostly low frequencies

time series with narrow features

Fourier Transform with both low and high frequencies

power spectral density with broad range of frequencies

Page 22: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

increasing variance

tim

e, t

freq

uenc

y, f

A)

increasing variance

B)

tmax fmax

0 0

Page 23: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

Property 2

the Fourier Transform of a spike

is constant

Page 24: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

spike

“Dirac Delta Function”

Normal curve with infinitesimal variance

infinitely high

but always has unit area

Page 25: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

δ(t-t0)

t

depiction of spike

t0

Page 26: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

important property of spike

Page 27: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

t

since the spike is zero everywhere except t0

t0

tt0

f(t0)

f(t0)

this product …

… is equivalent to this one

Page 28: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

so

Page 29: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

use the previous result when computing the Fourier Transform of a spike

Page 30: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

A spiky time series

has a “flat” Fourier Transform

and a “flat” power spectral density

Page 31: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

0 50 100 150 200 250-1

-0.5

0

0.5

1

time, t

d(t

)

-0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0.50

0.5

1

1.5

2

frequency, f

d(f

)A) spike function

B) its transform

frequency, f

time, t

d(t)

d(f)^

Page 32: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

Property 3

the Fourier Transform of cos(ω0t )is a pair of spikes at frequencies ±ω0

Page 33: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

cos(ω0t )has Fourier Trnsform

Page 34: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

as is shown by inserting into the Inverse Fourier Transform

Page 35: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

An oscillatory time series

has spiky Fourier Transformand a power spectral density with spectral peaks

Page 36: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

Property 4

the area under a time series

is the zero-frequency value of the Fourier Transform

Page 37: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.
Page 38: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

A time series with zero mean

has a Fourier Transformthat is zero at zero frequency

Page 39: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

MatLab

dt=fft(d); area = real(dt(1));

Page 40: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

Property 5

multiplying the Fourier Transform byexp( -i ω t0)delays the time series by t0

Page 41: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

use transformation of variablest’ = t - t0and notedt’ = dtandt±∞ corresponds to t’±∞

Page 42: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

0 50 100 150 200 250-1

-0.5

0

0.5

1

time, t

d(t

)

0 50 100 150 200 250-1

-0.5

0

0.5

1

time, t

d shifte

d(t

)d(

t)

time, t

time, t

d(t)

dshif

ted (

t)

Page 43: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

MatLab

t0 = t(16); ds=ifft(exp(-i*w*t0).*fft(d));

Page 44: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

Property 6

multiplying the Fourier Transform byi ωdifferentiates the time series

Page 45: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.
Page 46: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

use integration by parts

and assume that the times series is zeroas t±∞dvu uv duv

Page 47: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

0 50 100 150 200 250-1

0

1

time, t

d(t)

0 50 100 150 200 250-0.02

0

0.02

time, t

dd/d

t(t)

0 50 100 150 200 250-0.02

0

0.02

time, t

dd/d

t(t)

time, t

A)

B)

C)

d(t)

dd/dt

dd/dt

Page 48: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

MatLab

dddt=ifft(i*w.*fft(d));

Page 49: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

Property 7

dividing the Fourier Transform byi ωintegrates the time series

Page 50: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

this is another derivation by

integration by parts

but we’re skipping it here

Page 51: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

Fourier Transform of integral of d(t)

note that the zero-frequency value is undefined

(divide by zero)

this is the “integration constant”

Page 52: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

0 50 100 150 200 250-1

0

1

time, t

d(t)

0 50 100 150 200 250-100

0

100

time, t

inte

gral

0 50 100 150 200 250-100

0

100

time, t

inte

gral

time, t

A)

B)

C)

d(t)

d

(t)

dt

d(t

) dt

Page 53: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

MatLab

int2=ifft(i*fft(d).*[0,1./w(2:N)']');

set to zero to avoid dividing by zero (equivalent to an

integration constant of zero)

Page 54: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

Property 8

Fourier Transform of the

convolution of two time series

is the product of their transforms

Page 55: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

What’s a convolution ?

Page 56: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

the convolution of f(t) and g(t)is the integral

which is often abbreviated f(t) *g(t)not multiplication

not complex conjugation(too many uses of the asterisk!)

Page 57: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

uses of convolutions will be presented in the lecture after next

right now, just treat it as a mathematical quantity

Page 58: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.
Page 59: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

transformation of variablest’ = t-τ so dt’ = dt and t’±∞ when t±

reverse order of integration

change variables: t’ = t-τ

use exp(a+b)=exp(a)exp(b)

rearrange into the product of two separate Fourier Transforms

Page 60: Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.

Summary

1. FT of a Normal is a Normal curve2. FT of a spike is constant.3. FT of a cosine is a pair of spikes4. Multiplying FT by exp( -i ω t0 ) delays time

series

5. Multiplying the FT by i ω differentiates the time series

6. Dividing the FT by i ω integrates the time series

7. FT of convolution is product of FT’s