Environmental Data Analysis with Mat Lab Lecture 9
Environmental Data Analysis with Mat. Lab Lecture 9: Fourier Series
SYLLABUS Lecture 01 Lecture 02 Lecture 03 Lecture 04 Lecture 05 Lecture 06 Lecture 07 Lecture 08 Lecture 09 Lecture 10 Lecture 11 Lecture 12 Lecture 13 Lecture 14 Lecture 15 Lecture 16 Lecture 17 Lecture 18 Lecture 19 Lecture 20 Lecture 21 Lecture 22 Lecture 23 Lecture 24 Using Mat. Lab Looking At Data Probability and Measurement Error Multivariate Distributions Linear Models The Principle of Least Squares Prior Information Solving Generalized Least Squares Problems Fourier Series Complex Fourier Series Lessons Learned from the Fourier Transform Power Spectra Filter Theory Applications of Filters Factor Analysis Orthogonal functions Covariance and Autocorrelation Cross-correlation Smoothing, Correlation and Spectra Coherence; Tapering and Spectral Analysis Interpolation Hypothesis testing Hypothesis Testing continued; F-Tests Confidence Limits of Spectra, Bootstraps
purpose of the lecture detect and quantify periodicities in data
importance of periodicities
Stream Flow Neuse River discharge, cfs 365 days 1 year time, days
Air temperature Black Rock Forest 365 days 1 year
Air temperature Black Rock Forest 1 day time, days
temporal periodicities and their periods astronomical other natural anthropogenic rotation ocean waves electric power daily a few seconds 60 Hz revolution yearly
sinusoidal oscillation f(t) = C cos{ 2π (t-t 0) / T } d(t) amplitude, C period, T time, t delay, t 0
lingo temporal spatial f(t) = C cos{ 2π t / T } f(x) = C cos{ 2π x / λ } amplitude, C period, T wavelength, λ frequency, f=1/T - angular frequency, ω=2 π /T f(t) = C cos(ωt) wavenumber, k=2 π / λ f(x) = C cos(kx)
spatial periodicities and their wavelengths natural anthropogenic sand dunes furrows plowed in a field hundreds of meters tree rings a few millimeters few tens of cm
pairing sines and cosines to avoid using time delays
derived using trig identity A B
A A=C cos(ωt 0) B=C sin(ωt 0) 2 2 2 A +B =C = 2 C B A 2=C cos 2 (ωt 0) B 2=C sin 2 (ωt 0) 2 [cos (ωt 0 2 )+sin (ωt 0)]
Fourier Series linear model containing nothing but sines and cosines
ω’s are auxiliary variables A’s and B’s are model parameters
two choices values of frequencies? total number of frequencies?
surprising fact about time series with evenly sampled data Nyquist frequency
values of frequencies? evenly spaced, ωn = (n-1)Δ ω minimum frequency of zero maximum frequency of fny total number of frequencies? N/2+1 number of model parameters, M = number of data, N
implies
Number of Frequencies why N/2+1 and not N/2 ? first and last sine are omitted from the Fourier Series since they are identically zero:
cos(½NΔω t) cos(0 t) cos(Δω t) sin(Δωt) cos(2Δω t) sin(2Δω t)
Nyquist Sampling Theorem another way of stating it when m=n+N note evenly sampled times
Step 1: Insert discrete frequencies and times into l. h. s. of equations. ωn = (n-1)Δ ω and tk = (k-1) Δt
Step 2: Insert discrete frequencies and times into r. h. s. of equations. ωn = (n-1+N)Δ ω and tk = (k-1) Δt
Step 3: Note that l. h. s equals r. h. s. same as l. h. s.
Step 4: Identify unique region of ω-axis when m=n+N or when ωm=ωn+2ωny only a 2ωny interval of the ω -axis is unique say from -ωny to +ωny
Step 5: Apply symmetry of sines and cosines cos(ω t) has same shape as cos(-ω t) and sin(ω t) has same shape as sin(-ω t) so really only the 0 to ωny part of the ω-axis is unique
equivalent points on the ω-axis w -wny 0 wny 2 wny 3 wny
d 1 (t) = cos(w 1 t), with w 1=2 Dw d 1(t) d 2(t) = cos{w 2 t}, with w 2=(2+N)Dw, time, t d 2(t) time, t
problem of aliasing high frequencies masquerading as low frequencies solution: pre-process data to remove high frequencies before digitizing it
Discrete Fourier Series d = Gm
Least Squares Solution mest = [GTG]-1 GTd has substantial simplification … since it can be shown that …
frequency and time setup in Mat. Lab % N = number of data, presumed even % Dt is time sampling interval t = 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];
Building G in Mat. Lab % 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);
solving for model parameters in Mat. Lab gtgi = 2* ones(M, 1)/N; gtgi(1)=1/N; gtgi(M)=1/N; mest = gtgi. * (G'*d);
how to plot the model parameters? A’s and B ’s plot against frequency
power spectral density big at frequency ω when sine or cosine at the frequency has a large coefficient
alternatively, plot amplitude spectral density
amplitude spectral density Stream Flow Neuse River all interesting frequencies near origin, so plot period, T=1/f instead amplitude spectral density frequency, cycles per day 60. 0 days 182. 6 days 365. 2 days period, days
- Slides: 40