Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform 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 MatLab 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 understand some of the properties of the Discrete Fourier Transform from last week … time series = sum of sines and cosines k remember exp(iωt) = cos(ωt) + i sin(ωt) from last week … Discrete Fourier Transform of a time series coefficients time series power spectral density = 2 time series di ti Δt continuous function di ti Δt a time series is a discrete representation of a continuous function continuous function d(t) t What happens when to the Discrete Fourier Transform when we switch from discrete to continuous? Discrete Fourier Transform turns into Fourier Transform 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 function of frequency function of time power spectral density = 2 the inverse of the Fourier Transform is function of time function of frequency recall that an integral can be approximated by a summation f(t) f(ti) t ti Δt integral = area under curve = S area of rectangle = S width × height = Δt Si f(ti) 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) 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 similarly the 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 ways integrals 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 Normal curve with variance ½a-2 = σt2 [cos(ωt ) + i sin(ωt )] dt cos(ωt ) dt + i symmetric about zero sin(ωt ) dt antisymmetric about zero so integral zero look up in table of integrals Normal curve with variance 2a2 = σt-2 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 A) 0 time, t frequency, f 0 tmax B) increasing variance fmax increasing variance Property 2 the Fourier Transform of a spike is constant spike “Dirac Delta Function” Normal curve with infinitesimal variance infinitely high but always has unit area depiction of spike δ(t-t0) t0 t important property of spike since the spike is zero everywhere except t0 this product … f(t0) t0 t … is equivalent to this one f(t0) t0 t 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 A) spike function 1 d(t) 0.5 d(t) 0 -0.5 -1 2 0 50 B) its transform 100 time, t 150 200 250 time, t 1.5 d(f) ^ d(f) 1 0.5 0 -0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 frequency, f frequency, f 0.2 0.3 0.4 0.5 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 Transform and 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 Transform that is zero at zero frequency MatLab dt=fft(d); area = real(dt(1)); Property 5 multiplying the Fourier Transform by exp( -i ω t0) delays the time series by t0 use transformation of variables t’ = t - t0 and note dt’ = dt and t±∞ corresponds to t’±∞ 1 d(t) d(t) 0.5 0 -0.5 -1 0 50 100 150 200 250 200 250 time, t time, t 0.5 0 s d(t) d hifted(t) shifted (t) 1 d -0.5 -1 0 50 100 150 time, t time, t MatLab t0 = t(16); ds=ifft(exp(-i*w*t0).*fft(d)); Property 6 multiplying the Fourier Transform by iω differentiates the time series use integration by parts and assume that the times series is zero as t±∞ u dv v u v du A) d(t) d(t) 1 0 -1 0 50 100 150 200 250 150 200 250 150 200 250 time, t B) dd/dt(t) 0.02 dd/dt 0 -0.02 0 50 100 time, t C) dd/dt(t) 0.02 dd/dt 0 -0.02 0 50 100 time, t time, t MatLab dddt=ifft(i*w.*fft(d)); Property 7 dividing the Fourier Transform by iω integrates the time series this is another derivation by integration 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” A) d(t) d(t) 1 0 integral d(t) dt -1 0 50 100 150 200 250 150 200 250 150 200 250 time, t B) 100 0 -100 0 50 100 integral d(t) dt time, t C) 100 0 -100 0 50 100 time, t time, t 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 the convolution 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 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 transformation of variables t’ = t-τ so dt’ = dt and t’±∞ when t± Summary 1. 2. 3. 4. 5. FT of a Normal is a Normal curve FT of a spike is constant. FT of a cosine is a pair of spikes Multiplying FT by exp( -i ω t0 ) delays time series 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