19
Computational Fourier Analysis Mathematics, Computing and Nonlinear Oscillations Rubin H Landau Sally Haerer, Producer-Director Oregon State University with National Science Foundation Support Course: Computational Physics I (Prerequisite: Intro Computational Science) BMACC Blended Multimodal Access to Computational Physics Curricula 1/1

Computational Fourier Analysissites.science.oregonstate.edu/~landaur/Books/CPbook/eBook/Lectur… · Most any periodic function “represented” by Fourier series. Most any nonperiodic

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Computational Fourier Analysissites.science.oregonstate.edu/~landaur/Books/CPbook/eBook/Lectur… · Most any periodic function “represented” by Fourier series. Most any nonperiodic

Computational Fourier AnalysisMathematics, Computing and Nonlinear Oscillations

Rubin H Landau

Sally Haerer, Producer-Director

Oregon State Universitywith National Science Foundation Support

Course: Computational Physics I

(Prerequisite: Intro Computational Science)

BMACC

Blended Multimodal Access to Computational Physics Curricula

1 / 1

Page 2: Computational Fourier Analysissites.science.oregonstate.edu/~landaur/Books/CPbook/eBook/Lectur… · Most any periodic function “represented” by Fourier series. Most any nonperiodic

Outline

Text:Three Fourier Units

Unit I: Fourier series: Review & DFT(Only part of I today!)

Unit II: Signal filtering to reduce noiseUnit III: Fast Fourier transform (FFT)⇒

real time DFT

Today’s Lecture:

2 / 1

Page 3: Computational Fourier Analysissites.science.oregonstate.edu/~landaur/Books/CPbook/eBook/Lectur… · Most any periodic function “represented” by Fourier series. Most any nonperiodic

Problem: Amount of sin ωt in Nonlinear Oscillation?

ExampleExample (in green): Sawtooth function

t

-1

0

1

y(t)

0 20-1

0

1

Y()

ω

What “frequencies” present? (What does this mean?)Meaning: “Fourier decomposition (right)”Periodic, many sinusoids; yet, one periodOnly steady state, let transients die out

3 / 1

Page 4: Computational Fourier Analysissites.science.oregonstate.edu/~landaur/Books/CPbook/eBook/Lectur… · Most any periodic function “represented” by Fourier series. Most any nonperiodic

Physics Problem (see ODE): Nonharmonic Oscillator

Nonharmonic (nontranditional) oscillator

V (x) = k |x |p, p 6= 2

large p ⇒ square wellsquare well⇒ sawtooth

V

p = 2

xx

V

p = 6

Linear Nonlinear

Harmonic Anharmonic

Perturbed oscillator

V (x) = 12kx2 (1− 2

3αx)

Linear: 1st approximationAll Vs→ constant period TPeriodic not sinusoidal

xLinear

Nonlinear

Unbound

Harmonic

Anharmonic

V(x)

4 / 1

Page 5: Computational Fourier Analysissites.science.oregonstate.edu/~landaur/Books/CPbook/eBook/Lectur… · Most any periodic function “represented” by Fourier series. Most any nonperiodic

Math (Theory): Fourier Series

Fourier’s Theorem: Function RepresentationSingle-valued periodic function ("signal")Finite number discontinuities

y(t) =a0

2+∞∑

n=1

(an cos nωt + bn sin nωt) (1)

an ↔ cos nωt “in” y(t)Intensity(ω), Power(ω) ∝ a2

n + b2n

True frequency ω ≡ ω1 = 2πT 6= HO frequency

Need know period T , y(t + T ) = y(t)Period may depend on amplitude

5 / 1

Page 6: Computational Fourier Analysissites.science.oregonstate.edu/~landaur/Books/CPbook/eBook/Lectur… · Most any periodic function “represented” by Fourier series. Most any nonperiodic

Math: Fourier Series Fit

Fourier Series

y(t) =a0

2+∞∑

n=1

(an cos nωt + bn sin nωt) (2)

Theorem: Series = “Best Fit”

Least-squares sense: minimizes∑

i [y(ti)− yi ]2

⇒∑∞

i an cos nωt ' 〈 y(t) 〉⇒ miss discontinuitiesNeed infinite number of termsNot exact math fit (power series)Not good numerical solution (∞ terms)Not closed form analytic solution

6 / 1

Page 7: Computational Fourier Analysissites.science.oregonstate.edu/~landaur/Books/CPbook/eBook/Lectur… · Most any periodic function “represented” by Fourier series. Most any nonperiodic

Fourier Integrals (Transforms)

Nonperiodic Functions

–1.0

–0.5

0.0

0.5

1.0

–6 –4 –2 0 2 4 6

t

s = 1, τ = 0

y(t) =

b0 + b1 cos ω1t + b2 cos 2ω1t + · · ·

Nonperiodic ≡ T →∞⇒ continuous ωMath:

∑→∫

Numerically:∫→∑

Numerically: the same!

Fourier Semantics

ω1 = 2πT = fundamental

nω1 = nth harmonicω > ω1: overtones

b0: DC component∑normal modes

Modes: see next slide

7 / 1

Page 8: Computational Fourier Analysissites.science.oregonstate.edu/~landaur/Books/CPbook/eBook/Lectur… · Most any periodic function “represented” by Fourier series. Most any nonperiodic

Fourier Series for Nonlinear Oscillations?

y(t) =a0

2+∞∑

n=1

(an cos nωt + bn sin nωt) (3)

OK by Theorem if periodic, but

Nonlinear oscillators: ω1 = ω(A) = 2π/TIndividual terms 6= solutionLinear eqtn ↔ principle of linear superposition

y1(t), y2(t) = solutions (4)⇒ αy1(t) + βy2(t) = solution (5)

Useful if not too nonlinearBroadband spectrum⇒ chaosMany strong overtones

8 / 1

Page 9: Computational Fourier Analysissites.science.oregonstate.edu/~landaur/Books/CPbook/eBook/Lectur… · Most any periodic function “represented” by Fourier series. Most any nonperiodic

Determine Fourier Coefficients an, bn

Project Out Components

〈ω|y〉 =

∫ 2π

0dtcos nωt

[a0

2+∞∑

n=1

(an cos nωt + bn sin nωt)

](6)

⇒(

an

bn

)=

2T

∫ T

0dt(

cos nωtsin nωt

)y(t) (7)

a0 = 2 〈y(t)〉Be smart: use SymmetryOdd y(−t) = −y(t) ⇒ an ≡ 0Even y(−t) = y(t) ⇒ bn ≡ 0Realistic calculations:

∫→∑

, y(t < 0) =? ⇒ small bn

9 / 1

Page 10: Computational Fourier Analysissites.science.oregonstate.edu/~landaur/Books/CPbook/eBook/Lectur… · Most any periodic function “represented” by Fourier series. Most any nonperiodic

Determine Fourier Coefficients an, bn

Project Out Components

〈ω|y〉 =

∫ 2π

0dtcos nωt

[a0

2+∞∑

n=1

(an cos nωt + bn sin nωt)

](6)

⇒(

an

bn

)=

2T

∫ T

0dt(

cos nωtsin nωt

)y(t) (7)

a0 = 2 〈y(t)〉Be smart: use SymmetryOdd y(−t) = −y(t) ⇒ an ≡ 0Even y(−t) = y(t) ⇒ bn ≡ 0Realistic calculations:

∫→∑

, y(t < 0) =? ⇒ small bn

10 / 1

Page 11: Computational Fourier Analysissites.science.oregonstate.edu/~landaur/Books/CPbook/eBook/Lectur… · Most any periodic function “represented” by Fourier series. Most any nonperiodic

Determine Fourier Coefficients an, bn

Project Out Components

〈ω|y〉 =

∫ 2π

0dtcos nωt

[a0

2+∞∑

n=1

(an cos nωt + bn sin nωt)

](6)

⇒(

an

bn

)=

2T

∫ T

0dt(

cos nωtsin nωt

)y(t) (7)

a0 = 2 〈y(t)〉Be smart: use SymmetryOdd y(−t) = −y(t) ⇒ an ≡ 0Even y(−t) = y(t) ⇒ bn ≡ 0Realistic calculations:

∫→∑

, y(t < 0) =? ⇒ small bn

11 / 1

Page 12: Computational Fourier Analysissites.science.oregonstate.edu/~landaur/Books/CPbook/eBook/Lectur… · Most any periodic function “represented” by Fourier series. Most any nonperiodic

Determine Fourier Coefficients an, bn

Project Out Components

〈ω|y〉 =

∫ 2π

0dtcos nωt

[a0

2+∞∑

n=1

(an cos nωt + bn sin nωt)

](6)

⇒(

an

bn

)=

2T

∫ T

0dt(

cos nωtsin nωt

)y(t) (7)

a0 = 2 〈y(t)〉Be smart: use SymmetryOdd y(−t) = −y(t) ⇒ an ≡ 0Even y(−t) = y(t) ⇒ bn ≡ 0Realistic calculations:

∫→∑

, y(t < 0) =? ⇒ small bn

12 / 1

Page 13: Computational Fourier Analysissites.science.oregonstate.edu/~landaur/Books/CPbook/eBook/Lectur… · Most any periodic function “represented” by Fourier series. Most any nonperiodic

Determine Fourier Coefficients an, bn

Project Out Components

〈ω|y〉 =

∫ 2π

0dtcos nωt

[a0

2+∞∑

n=1

(an cos nωt + bn sin nωt)

](6)

⇒(

an

bn

)=

2T

∫ T

0dt(

cos nωtsin nωt

)y(t) (7)

a0 = 2 〈y(t)〉Be smart: use SymmetryOdd y(−t) = −y(t) ⇒ an ≡ 0Even y(−t) = y(t) ⇒ bn ≡ 0Realistic calculations:

∫→∑

, y(t < 0) =? ⇒ small bn

13 / 1

Page 14: Computational Fourier Analysissites.science.oregonstate.edu/~landaur/Books/CPbook/eBook/Lectur… · Most any periodic function “represented” by Fourier series. Most any nonperiodic

Example: Sawtooth Function, Analytic an, bn

Example

t

-1

0

1

y(t)

0 20-1

0

1

Y()

ω

y(t) =

{ tT/2 , 0 ≤ t ≤ T

2 (7)

t−TT/2 ,

T2 ≤ t ≤ T

Periodic, nonharmonic, discontinuous, sharp cornersOdd (⇒ sine series), obvious shift to left:

y(t) =t

T/2, −T

2≤ t ≤ T

2(8)

bn =2T

∫ +T/2

−T/2dt sin nωt

tT/2

(above) (9)

⇒ y(t) =2π

[sinωt − 1

2sin 2ωt +

13

sin 3ωt · · ·]

(10)

14 / 1

Page 15: Computational Fourier Analysissites.science.oregonstate.edu/~landaur/Books/CPbook/eBook/Lectur… · Most any periodic function “represented” by Fourier series. Most any nonperiodic

Exercise: Sawtooth Function Synthesis

1 Sum Fourier series for n = 2,4,10,20 terms.2 Plot two periods & compare to signal.3 Check that series gives the mean value (0) at discontinuity4 Gibbs overshoot: Check that series overshoots

discontinuity by about 9%, and that this persists even whensumming over a large number of terms.

5 You deserve a break right now!

15 / 1

Page 16: Computational Fourier Analysissites.science.oregonstate.edu/~landaur/Books/CPbook/eBook/Lectur… · Most any periodic function “represented” by Fourier series. Most any nonperiodic

Math (Theory): Fourier Transforms

Fourier series = right tool for periodic functions

Fourier Integral for Nonperiodic Functions

–1.0

–0.5

0.0

0.5

1.0

–6 –4 –2 0 2 4 6

t

s = 1, τ = 0

Wave packets, pulsesContinuous frequencies

Signal: y(t) =

∫ +∞

−∞dω Y (ω)

eiωt√

2π(11)

Think linear superposition: exp(iωt) = cosωt + i sinωtComplex transform Y (ω) ∼ (an,bn) ∼ coefficients1/√

2π, +iωt = physics conventions

16 / 1

Page 17: Computational Fourier Analysissites.science.oregonstate.edu/~landaur/Books/CPbook/eBook/Lectur… · Most any periodic function “represented” by Fourier series. Most any nonperiodic

Fourier Transform: y(t)→ Y (ω)

t

-1

0

1

y(t)

0 20-1

0

1

Y()

ω

Fourier Amplitudes (an)→ Transform

Signal, function: y(t) =

∫ +∞

−∞dω Y (ω)

e+iωt√

2π(12)

Transform, spectral: Y (ω) =

∫ +∞

−∞dt y(t)

e−iωt√

2π(13)

Power Spectrum ∝ |Y (ω)|2, maybe log10 |Y |2

17 / 1

Page 18: Computational Fourier Analysissites.science.oregonstate.edu/~landaur/Books/CPbook/eBook/Lectur… · Most any periodic function “represented” by Fourier series. Most any nonperiodic

Math Identity: Inversion of Transform

Substitute for y(t) and rearrange

Y (ω) =

∫ +∞

−∞dt

e−iωt√

∫ +∞

−∞dω′

eiω′t√

2πY (ω′) (14)

Y (ω) =

∫ +∞

−∞dω′

{∫ +∞

−∞dt

ei(ω′−ω)t

}Y (ω′) (15)

Depends on noncomputable Dirac delta function:∫ +∞

−∞dt ei(ω′−ω)t = 2πδ(ω′ − ω) (16)

Don’t try on computer!

18 / 1

Page 19: Computational Fourier Analysissites.science.oregonstate.edu/~landaur/Books/CPbook/eBook/Lectur… · Most any periodic function “represented” by Fourier series. Most any nonperiodic

Summary

Most any periodic function “represented” by Fourier series.Most any nonperiodic function “represented” by Fourierintegral.Infinite series or integral not practical algorithm or inexperiment.Must know actual period.Period depends on amplitude in general.DFT (next): when done is simple, elegant and powerfulFast Fourier transform (FFT) is faster.That’s all folks!

19 / 1