Environmental Data Analysis with MatLab Lecture 2: Looking at Data.
Environmental Data Analysis with MatLab
description
Transcript of Environmental Data Analysis with MatLab
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
purpose of the lecture
understand some of the properties of the
Discrete Fourier Transform
from last week …
time series = sum of sines and cosines
rememberexp(iωt) = cos(ωt) + i sin(ωt)
k
time series
from last week …
Discrete Fourier Transform of a time series
coefficients
power spectral density = 2
di
ti Δt
time series
di
ti Δta time series is a discrete representation of a
continuous function
continuous function
d(t)
t
continuous function
What happens when to the Discrete Fourier Transform when we switch from discrete to continuous?
Discrete Fourier Transform
Fourier Transform
turns into
note the use of the tilde to distinguish a the Fourier Transform from the function itself.
The two functions are different!
Fourier Transform
function of timefunction of frequency
Fourier Transform
power spectral density = 2
function of time function of frequency
the inverse of the Fourier Transform is
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
then if we use N rectangleseach of width Δt
andeach 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)
so except for a scaling factor ofΔtthe Discrete Fourier Transform is the discrete
version of the Fourier Transform of a transient function, d(t)
scaling factor
similarlythe Fourier Series is an approximation of
the Inverse Fourier Transform
Inverse Fourier Transform Fourier Series
(up to an overall scaling of Δω)
Fourier Transform
in some waysintegrals are easier to work with than
summations
Property 1
the Fourier Transform of a Normal curve with variance σt2
is a Normal curve with variance σω2 =σt-2
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
look up in table of integrals
Normal curve with variance 2a2 = σt-2
time series with broad featuresFourier Transform with mostly low frequencies
power spectral density with mostly low frequencies
time series with narrow featuresFourier Transform with both low and high frequenciespower spectral density with broad range of frequencies
increasing variance
time,
t
freq
uenc
y, f
A)
increasing variance
B)
tmax fmax
0 0
Property 2
the Fourier Transform of a spike
is constant
spike“Dirac Delta Function”
Normal curve with infinitesimal variance
infinitely highbut always has unit area
δ(t-t0)
t
depiction of spike
t0
important property of spike
t
since the spike is zero everywhere except t0
t0
tt0
f(t0)
f(t0)
this product …
… is equivalent to this one
so
use the previous result when computing the Fourier Transform of a spike
A spiky time series
has a “flat” Fourier Transform
and a “flat” power spectral density
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)^
Property 3
the Fourier Transform of cos(ω0t )is a pair of spikes at frequencies ±ω0
cos(ω0t )has Fourier Trnsform
as is shown by inserting into the Inverse Fourier Transform
An oscillatory time series
has spiky Fourier Transformand a power spectral density with spectral peaks
Property 4
the area under a time series
is the zero-frequency value of the Fourier Transform
A time series with zero mean
has a Fourier Transformthat is zero at zero frequency
MatLab
dt=fft(d); area = real(dt(1));
Property 5
multiplying the Fourier Transform byexp( -i ω t0)delays the time series by t0
use transformation of variablest’ = t - t0and notedt’ = dtandt±∞ corresponds to t’±∞
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)
dshift
ed(t)
MatLab
t0 = t(16); ds=ifft(exp(-i*w*t0).*fft(d));
Property 6
multiplying the Fourier Transform byi ωdifferentiates the time series
use integration by partsand assume that the times series is zeroas t±∞
dvu uv duv
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
MatLab
dddt=ifft(i*w.*fft(d));
Property 7
dividing the Fourier Transform byi ωintegrates the time series
this is another derivation byintegration by parts
but we’re skipping it here
Fourier Transform of integral of d(t)
note that the zero-frequency value is undefined(divide by zero)
this is the “integration constant”
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) d
t
d(t)
dt
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)
Property 8
Fourier Transform of theconvolution of two time series
is the product of their transforms
What’s a convolution ?
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!)
uses of convolutions will be presented in the lecture after next
right now, just treat it as a mathematical quantity
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
Summary1. 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
series5. Multiplying the FT by i ω differentiates the time
series6. Dividing the FT by i ω integrates the time series7. FT of convolution is product of FT’s