Environmental Data Analysis with MatLab Lecture 10: Complex Fourier Series.

Slides:



Advertisements
Similar presentations
Nature of light and theories about it
Advertisements

Feichter_DPG-SYKL03_Bild-01. Feichter_DPG-SYKL03_Bild-02.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. *See PowerPoint Lecture Outline for a complete, ready-made.
1 Copyright © 2013 Elsevier Inc. All rights reserved. Chapter 116.
1 Copyright © 2013 Elsevier Inc. All rights reserved. Appendix 01.
1 Copyright © 2013 Elsevier Inc. All rights reserved. Chapter 28.
1 Copyright © 2013 Elsevier Inc. All rights reserved. Chapter 38.
Chapter 1 Image Slides Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
6.6 Analyzing Graphs of Quadratic Functions
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Chapter R: Reference: Basic Algebraic Concepts
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
MULTIPLYING MONOMIALS TIMES POLYNOMIALS (DISTRIBUTIVE PROPERTY)
SUBTRACTING INTEGERS 1. CHANGE THE SUBTRACTION SIGN TO ADDITION
Solve Multi-step Equations
Math Review with Matlab:
Notes 18 ECE Microwave Engineering Multistage Transformers
Chapter 15 Complex Numbers
Warm-up Divide the following using Long Division:
The Fourier Transform I
MAT 205 F08 Chapter 12 Complex Numbers.
Math Review with Matlab:
§ 7.7 Complex Numbers.
The Fast Fourier Transform (and DCT too…)
15. Oktober Oktober Oktober 2012.
Leo Lam © Signals and Systems EE235. Courtesy of Phillip Leo Lam ©
Solving Equations How to Solve Them
Environmental Data Analysis with MatLab
Squares and Square Root WALK. Solve each problem REVIEW:
We are learning how to read the 24 hour clock
Lecture 1 Describing Inverse Problems. Syllabus Lecture 01Describing Inverse Problems Lecture 02Probability and Measurement Error, Part 1 Lecture 03Probability.
Chapter 5 Test Review Sections 5-1 through 5-4.
ECON 397 Macroeconometrics Cunningham
Addition 1’s to 20.
25 seconds left…...
S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Laplace Transform Math Review with Matlab: Fundamentals.
Week 1.
We will resume in: 25 Minutes.
Lecture 20 Continuous Problems Linear Operators and Their Adjoints.
Computer Vision Lecture 7: The Fourier Transform
Environmental Data Analysis with MatLab Lecture 21: Interpolation.
Lecture 10 Nonuniqueness and Localized Averages. Syllabus Lecture 01Describing Inverse Problems Lecture 02Probability and Measurement Error, Part 1 Lecture.
Math Review with Matlab:
Environmental Data Analysis with MatLab Lecture 15: Factor Analysis.
Lecture 14 Nonlinear Problems Grid Search and Monte Carlo Methods.
Environmental Data Analysis with MatLab Lecture 8: Solving Generalized Least Squares Problems.
Lecture 15 Orthogonal Functions Fourier Series. LGA mean daily temperature time series is there a global warming signal?
Environmental Data Analysis with MatLab Lecture 9: Fourier Series.
Math Review with Matlab:
Environmental Data Analysis with MatLab
Environmental Data Analysis with MatLab Lecture 13: Filter Theory.
Environmental Data Analysis with MatLab Lecture 16: Orthogonal Functions.
Environmental Data Analysis with MatLab Lecture 23: Hypothesis Testing continued; F-Tests.
Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.
Environmental Data Analysis with MatLab
Environmental Data Analysis with MatLab Lecture 12: Power Spectral Density.
Environmental Data Analysis with MatLab Lecture 17: Covariance and Autocorrelation.
Environmental Data Analysis with MatLab Lecture 5: Linear Models.
Environmental Data Analysis with MatLab Lecture 3: Probability and Measurement Error.
Environmental Data Analysis with MatLab Lecture 24: Confidence Limits of Spectra; Bootstraps.
Environmental Data Analysis with MatLab Lecture 7: Prior Information.
Environmental Data Analysis with MatLab Lecture 20: Coherence; Tapering and Spectral Analysis.
Environmental Data Analysis with MatLab Lecture 9: Fourier Series.
Environmental Data Analysis with MatLab Lecture 10: Complex Fourier Series.
Part 4 Chapter 16 Fourier Analysis PowerPoints organized by Prof. Steve Chapra, University All images copyright © The McGraw-Hill Companies, Inc. Permission.
Environmental Data Analysis with MatLab 2 nd Edition Lecture 14: Applications of Filters.
Environmental Data Analysis with MatLab 2 nd Edition Lecture 22: Linear Approximations and Non Linear Least Squares.
Environmental Data Analysis with MatLab
Environmental Data Analysis with MatLab 2nd Edition
Presentation transcript:

Environmental Data Analysis with MatLab Lecture 10: Complex Fourier Series

Lecture 01Using MatLab Lecture 02Looking At Data Lecture 03Probability and Measurement Error Lecture 04Multivariate Distributions Lecture 05Linear Models Lecture 06The Principle of Least Squares Lecture 07Prior Information Lecture 08Solving Generalized Least Squares Problems Lecture 09Fourier Series Lecture 10Complex Fourier Series Lecture 11Lessons Learned from the Fourier Transform Lecture 12Power Spectra Lecture 13Filter Theory Lecture 14Applications of Filters Lecture 15Factor Analysis Lecture 16Orthogonal functions Lecture 17Covariance and Autocorrelation Lecture 18Cross-correlation Lecture 19Smoothing, Correlation and Spectra Lecture 20Coherence; Tapering and Spectral Analysis Lecture 21Interpolation Lecture 22 Hypothesis testing Lecture 23 Hypothesis Testing continued; F-Tests Lecture 24 Confidence Limits of Spectra, Bootstraps SYLLABUS

purpose of the lecture switch from Fourier Series containing sines and cosines to Fourier Series containing complex exponentials

purpose of the lecture switch from Fourier Series containing sin( ω t) and cos( ω t) to Fourier series containing exp(-i ω t) and exp(+i ω t)

review of complex numbers

imaginary unit i such that i 2 = -1

complex number a = a r + i a i real part imaginary part

adding complex numbers a = a r + i a i b = b r + i b i c = a+b = (a r + i a i )+ (b r + i b i ) = (a r + b r )+ i(a i +b i ) crcr cici … just add real and imaginary parts, separately

subtracting complex numbers a = a r + i a i b = b r + i b i c = a-b = (a r + i a i )-(b r + i b i ) = (a r - b r )+ i(a i - b i ) crcr cici … just subtract real and imaginary parts, separately

multiplying complex numbers a = a r + i a i b = b r + i b i c = ab = (a r + i a i )(b r + i b i ) = = a r b r + i a r b i + i a i b r + i 2 a i b i = (a r b r - a i b i )+ i(a r b i + a i b r ) crcr cici … like multiplying polynomials

complex conjugate, a* a = a r + i a i a* = a r - i a i

absolute value, | a | | a | = [ a r 2 + a i 2 ] ½ note | a | 2 = a* a

Eulers Formula exp(iz) = cos(z) + i sin(z) … where does that come from ???

start from the Taylor series expansions exp(x) = 1 + x + x 2 /2 + x 3 /6 + x 4 /24 + … cos(x) = x 2 / x 4 /24 + … sin(x) = 0 + x x 3 / …

exp(x) substitute in x=iz exp(x) = 1 + x + x 2 /2 + x 3 /6 + x 4 /24 + … exp(iz) = 1 + iz - z 2 /2 - iz 3 /6 + z 4 /24 + …

cos(x) substitute in x=z cos(x) = x 2 / x 4 /24 + … cos(z) = z 2 / z 4 /24 + …

sin(x) substitute in x=z and multiply by i sin(x) = 0 + x x 3 / … i sin(z) = 0 + iz iz 3 / …

add cos(z) and i sin(z) cos(z) = z 2 / z 4 /24 + … + i sin(z) = 0 + iz iz 3 / … = cos(z) + i sin(z) = 1 + iz - z 2 /2 - iz 3 /6 + z 4 /24 + … compare with results for exp(iz) exp(iz) = 1 + iz - z 2 /2 - iz 3 /6 + z 4 /24 + … theyre equal!

note that since exp(iz) = cos(z) + i sin(z) then |exp(iz) |= cos 2 (z) + sin 2 (z) = 1

any complex number can be written z = r exp(iθ) where r = | z | and θ=tan -1 (z i /z r )

MatLab handles complex numbers completely transparently a = 2 + 3*i; b = 4 + 6*i; c = a+b; works just fine

Warning! accidentally resetting i to something other than i is so easy i=100; (and then you get nonsense) so execute a clear i; at the top of your script if you plan to use i

or use the alternate notation a = complex(2,3); b = complex(4,6); c = a+b; which is safer

end of review

Eulers Formulas complex exponentials can be written as sines and cosines

or reverse them sine and cosines can be written as complex exponentials

so a Fourier Series alternatively can be written as a sum of sines and cosines or a sum of complex exponentials

paired terms sines and cosines of the same frequency, ω, are paired and positive and negative complex exponentials of the frequencies, ω, are paired … so as to be able to represent a time-shifted sinusoid

A and B and C - and C + must be related

AB =0 implies C I - = -C I + =0 implies C R + = C R -

summary C r is an even function of frequency C i is an odd function of frequency coefficients at corresponding positive and negatives are complex conjugates C(- ω ) = C*( ω )

ω CrCr CiCi illustration of symmetry of

old-style Fourier Series non-negative frequencies only from 0 to ω ny

new-style Fourier Series or Inverse Discrete Fourier Transform non-negative frequencies negative frequencies added for compatibility with MatLab

why the weird ordering of frequencies? ω n = ( 0, Δω, 2Δω, …,½N Δω, -(½N -1) Δω, …, -2 Δω, -Δω ) same as ω n = ( 0, Δω, 2Δω, …,½N Δω, (½N +1) Δω, …, (N-1)Δω, NΔω ) non-negative frequencies negative frequencies non-negative frequencies up to Nyquist non-negativefrequencies above the Nyquist

least-squares solution for the Fourier coefficients, C n or Discrete Fourier Transform … derivation requires complex version of least- squares. See text of details …

MatLab Fourier Coefficients C j from time series d n c = fft(d); vector of N data vector of N complex Fourier coefficients

MatLab time series d n from Fourier Coefficients C j d = ifft(c); vector of N data vector of N complex Fourier coefficients

standard setup M=N; tmax=Dt*(N-1); t=Dt*[0:N-1]'; fmax=1/(2.0*Dt); df=fmax/(N/2); f=df*[0:N/2,-N/2+1:-1]'; Nf=N/2+1; dw=2*pi*df; w=dw*[0:N/2,-N/2+1:-1]'; Nw=Nf;

standard setup M=N; tmax=Dt*(N-1); t=Dt*[0:N-1]'; fmax=1/(2.0*Dt); df=fmax/(N/2); f=df*[0:N/2,-N/2+1:-1]'; Nf=N/2+1; dw=2*pi*df; w=dw*[0:N/2,-N/2+1:-1]'; Nw=Nf; same number M of Fourier Coefficients as number N of data

standard setup M=N; tmax=Dt*(N-1); t=Dt*[0:N-1]'; fmax=1/(2.0*Dt); df=fmax/(N/2); f=df*[0:N/2,-N/2+1:-1]'; Nf=N/2+1; dw=2*pi*df; w=dw*[0:N/2,-N/2+1:-1]'; Nw=Nf; maximum time, for N data sampled at Dt

standard setup M=N; tmax=Dt*(N-1); t=Dt*[0:N-1]'; fmax=1/(2.0*Dt); df=fmax/(N/2); f=df*[0:N/2,-N/2+1:-1]'; Nf=N/2+1; dw=2*pi*df; w=dw*[0:N/2,-N/2+1:-1]'; Nw=Nf; time column-vector

standard setup M=N; tmax=Dt*(N-1); t=Dt*[0:N-1]'; fmax=1/(2.0*Dt); df=fmax/(N/2); f=df*[0:N/2,-N/2+1:-1]'; Nf=N/2+1; dw=2*pi*df; w=dw*[0:N/2,-N/2+1:-1]'; Nw=Nf; Nyquist frequency, f ny

standard setup M=N; tmax=Dt*(N-1); t=Dt*[0:N-1]'; fmax=1/(2.0*Dt); df=fmax/(N/2); f=df*[0:N/2,-N/2+1:-1]'; Nf=N/2+1; dw=2*pi*df; w=dw*[0:N/2,-N/2+1:-1]'; Nw=Nf; frequency sampling, Δf

standard setup M=N; tmax=Dt*(N-1); t=Dt*[0:N-1]'; fmax=1/(2.0*Dt); df=fmax/(N/2); f=df*[0:N/2,-N/2+1:-1]'; Nf=N/2+1; dw=2*pi*df; w=dw*[0:N/2,-N/2+1:-1]'; Nw=Nf; frequency column- vector

standard setup M=N; tmax=Dt*(N-1); t=Dt*[0:N-1]'; fmax=1/(2.0*Dt); df=fmax/(N/2); f=df*[0:N/2,-N/2+1:-1]'; Nf=N/2+1; dw=2*pi*df; w=dw*[0:N/2,-N/2+1:-1]'; Nw=Nf; number of frequencies between 0 and Nyquist

standard setup M=N; tmax=Dt*(N-1); t=Dt*[0:N-1]'; fmax=1/(2.0*Dt); df=fmax/(N/2); f=df*[0:N/2,-N/2+1:-1]'; Nf=N/2+1; dw=2*pi*df; w=dw*[0:N/2,-N/2+1:-1]'; Nw=Nf; angular frequency sampling, Δω

standard setup M=N; tmax=Dt*(N-1); t=Dt*[0:N-1]'; fmax=1/(2.0*Dt); df=fmax/(N/2); f=df*[0:N/2,-N/2+1:-1]'; Nf=N/2+1; dw=2*pi*df; w=dw*[0:N/2,-N/2+1:-1]'; Nw=Nf; angular frequency column- vector

standard setup M=N; tmax=Dt*(N-1); t=Dt*[0:N-1]'; fmax=1/(2.0*Dt); df=fmax/(N/2); f=df*[0:N/2,-N/2+1:-1]'; Nf=N/2+1; dw=2*pi*df; w=dw*[0:N/2,-N/2+1:-1]'; Nw=Nf; number of angular frequencies between 0 and Nyquist

Computing Power Spectral Density % compute Fourier coefficients mest = fft(d); % compute amplitude spectral density s=abs(mest(1:Nw)); % compute power spectral density s2=s^2;

Spectral Density % compute Fourier coefficients mest = fft(d); % compute amplitude spectral density s=abs(mest(1:Nw)); % compute power spectral density s2=s^2; note that negative frequencies are discarded since they are redundant

Why The Switch to Complex? One function, exp(), is better than two, cos() & sin() exp() is algebraically simpler than cos() & sin(), e.g. exp(a) / exp(b) = exp( a – b) which substantially simplifies formulas Tradition – thats the way everyone does it! Or more importantly, thats the way MatLab does it.