![Page 1: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/1.jpg)
Environmental Data Analysis with MatLab
Lecture 9:
Fourier Series
![Page 2: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/2.jpg)
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 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/3.jpg)
purpose of the lecture
detect and quantify periodicities in data
![Page 4: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/4.jpg)
importance of periodicities
![Page 5: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/5.jpg)
Stream FlowNeuse River
disc
harg
e, c
fs
time, days
365 days1 year
![Page 6: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/6.jpg)
Air temperatureBlack Rock Forest
365 days1 year
![Page 7: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/7.jpg)
Air temperatureBlack Rock Forest
time, days
1 day
![Page 8: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/8.jpg)
temporal periodicitiesand their periods
astronomical
rotationdaily
revolutionyearly
other natural
ocean wavesa few seconds
anthropogenic
electric power60 Hz
![Page 9: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/9.jpg)
0 10 20 30 40 50 60 70 80 90-3
-2
-1
0
1
2
3
time, t
d(t)
cosine example
delay, t0
amplitude, C
period, T
d(t)
time, t
sinusoidal oscillationf(t) = C cos{ 2π (t-t0) / T }
![Page 10: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/10.jpg)
amplitude, C
lingo
temporal
f(t) = C cos{ 2π t / T }spatial
f(x) = C cos{ 2π x / λ }amplitude, C
period, T wavelength, λfrequency, f=1/T
angular frequency, ω=2 π /T wavenumber, k=2 π / λ-
f(t) = C cos(ωt) f(x) = C cos(kx)
![Page 11: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/11.jpg)
spatial periodicitiesand their wavelengths
natural
sand duneshundreds of meters
tree ringsa few millimeters
anthropogenic
furrows plowed
in a fieldfew tens of cm
![Page 12: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/12.jpg)
pairing sines and cosinesto avoid using time delays
![Page 13: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/13.jpg)
derived using trig identity
A B
![Page 14: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/14.jpg)
A BA=C cos(ωt0)B=C sin(ωt0) A2=C cos2 (ωt0)B2=C sin2 (ωt0)A2+B2=C2 [cos2 (ωt0)+sin2 (ωt0)]= C2
![Page 15: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/15.jpg)
Fourier Serieslinear model containing nothing but
sines and cosines
![Page 16: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/16.jpg)
A’s and B’s aremodel parameters
ω’s are auxiliary variables
![Page 17: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/17.jpg)
two choices
values of frequencies?
total number of frequencies?
![Page 18: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/18.jpg)
surprising fact about time series with evenly sampled data
Nyquist frequency
![Page 19: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/19.jpg)
values of frequencies?
evenly spaced, ωn = (n-1)Δ ω
minimum frequency of zero
maximum frequency of fnytotal number of frequencies? N/2+1
number of model parameters, M= number of data, N
![Page 20: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/20.jpg)
implies
![Page 21: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/21.jpg)
Number of Frequencieswhy N/2+1 and not N/2 ?
first and last sine are omitted from the Fourier Series since they are
identically zero:
![Page 22: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/22.jpg)
-2 0 20
5
10
15
20
25
30
col 1
tim
e,
s
-2 0 20
5
10
15
20
25
30
col 2
-2 0 20
5
10
15
20
25
30
col 3
-2 0 20
5
10
15
20
25
30
col 4
-2 0 20
5
10
15
20
25
30
col 5
-2 0 20
5
10
15
20
25
30
col 32cos(Δω t)cos(0t) sin(Δωt) cos(2Δω t) sin(2Δω t)cos(½NΔω t)
![Page 23: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/23.jpg)
Nyquist Sampling Theorem
when m=n+Nanother way of stating it
note evenly sampled times
![Page 24: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/24.jpg)
ωn = (n-1)Δ ω and tk = (k-1) Δt
Step 1: Insert discrete frequencies and times into l.h.s. of equations.
![Page 25: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/25.jpg)
ωn = (n-1+N)Δ ω and tk = (k-1) Δt
Step 2: Insert discrete frequencies and times into r.h.s. of equations.
![Page 26: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/26.jpg)
same as l.h.s.
same as l.h.s.
Step 3: Note that l.h.s equals r.h.s.
![Page 27: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/27.jpg)
when m=n+Nor when
ωm=ωn+2ωny
only a 2ωny interval of the ω -axis is uniquesay from-ωny to +ωny
Step 4: Identify unique region of ω-axis
![Page 28: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/28.jpg)
cos(ω t) has same shape as cos(-ω t) and
sin(ω t) has same shape as sin(-ω t) so really only the
0 to ωnypart of the ω-axis is unique
Step 5: Apply symmetry of sines and cosines
![Page 29: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/29.jpg)
w
-wny wny 2wny 3wny0
equivalent points on the ω-axis
![Page 30: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/30.jpg)
0 5 10 15 20-2
-1
0
1
2
time, t
d1(t
)
0 5 10 15 20-2
-1
0
1
2
time, t
d2(t
)d2(t)
d1(t)
time, t
time, t
d1 (t) = cos(w1t), with w1=2Dw
d2(t) = cos{w2t}, with w2=(2+N)Dw,
![Page 31: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/31.jpg)
problem of aliasing
high frequenciesmasquerading as low frequencies
solution:pre-process data to remove high
frequenciesbefore digitizing it
![Page 32: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/32.jpg)
Discrete Fourier Series
d = Gm
![Page 33: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/33.jpg)
Least Squares Solution mest = [GTG]-1 GTdhas substantial simplification
… since it can be shown that …
![Page 34: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/34.jpg)
% N = number of data, presumed even% Dt is time sampling intervalt = Dt*[0:N-1]’;
Df = 1 / (N * Dt );Dw = 2 * pi / (N * Dt);
Nf = N/2+1;Nw = N/2+1;
f = Df*[0:N/2];w = Dw*[0:N/2];
frequency and time setupin MatLab
![Page 35: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/35.jpg)
% set up G G=zeros(N,M); % zero frequency column G(:,1)=1; % interior M/2-1 columns for i = [1:M/2-1] j = 2*i; k = j+1; G(:,j)=cos(w(i+1).*t); G(:,k)=sin(w(i+1).*t); end % nyquist column G(:,M)=cos(w(Nw).*t);
Building G in MatLab
![Page 36: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/36.jpg)
gtgi = 2* ones(M,1)/N; gtgi(1)=1/N; gtgi(M)=1/N; mest = gtgi .* (G'*d);
solving for model parameters in MatLab
![Page 37: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/37.jpg)
how to plot the model parameters?A’s and B ’splot
against frequency
![Page 38: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/38.jpg)
power spectral density
big at frequency ω when
when sine or cosine at the frequency
has a large coefficient
![Page 39: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/39.jpg)
alternatively, plot
amplitude spectral density
![Page 40: Environmental Data Analysis with MatLab Lecture 9: Fourier Series](https://reader033.vdocuments.us/reader033/viewer/2022042603/56649cc15503460f94988618/html5/thumbnails/40.jpg)
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.50
1000
2000
3000
frequency, cycles per day
spec
trum
0 100 200 300 400 500 600 700 800 900 10000
500
1000
1500
2000
period, days
spec
trum
365.2 days
period, days
frequency, cycles per day
ampl
itud
e sp
ectr
al d
ensi
ty
182.6 days60.0 days
ampl
itud
e sp
ectr
al d
ensi
ty
Stream FlowNeuse River
all interesting frequencies near origin,so plot period, T=1/f instead