Spectral Analysis Using Excel - CSAAPTcsaapt.org/uploads/3/4/4/2/34425343/csaapt_tran_2017.pdf ·...

20
Spectral Analysis Using Excel P. Tran John Tyler Community College

Transcript of Spectral Analysis Using Excel - CSAAPTcsaapt.org/uploads/3/4/4/2/34425343/csaapt_tran_2017.pdf ·...

Page 1: Spectral Analysis Using Excel - CSAAPTcsaapt.org/uploads/3/4/4/2/34425343/csaapt_tran_2017.pdf · Spectral analysis of sound from a guitar. Applications of Fourier Transform Signal

Spectral Analysis Using Excel

P. Tran

John Tyler Community College

Page 2: Spectral Analysis Using Excel - CSAAPTcsaapt.org/uploads/3/4/4/2/34425343/csaapt_tran_2017.pdf · Spectral analysis of sound from a guitar. Applications of Fourier Transform Signal

Overview

Calculating Fourier transform using Excel.

Spectral analysis of sound from a guitar.

Page 3: Spectral Analysis Using Excel - CSAAPTcsaapt.org/uploads/3/4/4/2/34425343/csaapt_tran_2017.pdf · Spectral analysis of sound from a guitar. Applications of Fourier Transform Signal

Applications of Fourier Transform

Signal processing

Quantum mechanics: solving the time-dependent Schrödinger equation

Page 4: Spectral Analysis Using Excel - CSAAPTcsaapt.org/uploads/3/4/4/2/34425343/csaapt_tran_2017.pdf · Spectral analysis of sound from a guitar. Applications of Fourier Transform Signal

Evolution of a Wave Packet in a 1D Potential

𝑖ℏ𝜕𝜓

𝜕𝑡= 𝐻𝜓

𝜓 𝑥, 𝑡 = 𝑒−𝑖𝐻ℏ𝑡 𝜓(𝑥, 0)

𝐻 =(ℏ𝑘)2

2𝑚+ 𝑉(𝑥)

𝜓 𝑥, Δ𝑡 ≅ 𝑒−𝑖ℏ𝑉(𝑥)

∆𝑡2 𝑒−

𝑖ℏℏ𝑘 2

2𝑚 ∆𝑡𝑒−𝑖ℏ𝑉(𝑥)

∆𝑡2 𝜓(𝑥, 0)

Page 5: Spectral Analysis Using Excel - CSAAPTcsaapt.org/uploads/3/4/4/2/34425343/csaapt_tran_2017.pdf · Spectral analysis of sound from a guitar. Applications of Fourier Transform Signal

Evolution of a Wave Packet in a 1D Potential

𝜓1 𝑥, Δ𝑡 = 𝑒−𝑖ℏ𝑉(𝑥)

∆𝑡2 𝜓(𝑥, 0)

𝜓2 𝑥, Δ𝑡 = 𝑒−𝑖ℏℏ𝑘 2

2𝑚 ∆𝑡𝜓1 𝑥, Δ𝑡

𝜓 𝑥, Δ𝑡 = 𝑒−𝑖ℏ𝑉(𝑥)

∆𝑡2 𝜓2 𝑥, Δ𝑡

𝜓 𝑥, Δ𝑡 ≅ 𝑒−𝑖ℏ𝑉(𝑥)

∆𝑡2 𝑒−

𝑖ℏℏ𝑘 2

2𝑚∆𝑡𝑒−

𝑖ℏ𝑉(𝑥)

∆𝑡2 𝜓(𝑥, 0)

Diagonal in real space

Diagonal in k space

Diagonal in real space

Page 6: Spectral Analysis Using Excel - CSAAPTcsaapt.org/uploads/3/4/4/2/34425343/csaapt_tran_2017.pdf · Spectral analysis of sound from a guitar. Applications of Fourier Transform Signal

Why Excel?

Want a computing platform that all students can have access to.

Page 7: Spectral Analysis Using Excel - CSAAPTcsaapt.org/uploads/3/4/4/2/34425343/csaapt_tran_2017.pdf · Spectral analysis of sound from a guitar. Applications of Fourier Transform Signal

Nuts and Bolts

𝑓 𝜔𝑖 = න𝑓(𝑡)𝑒−𝑖𝜔𝑖𝑡 𝑑𝑡

Don’t calculate all components at once: too much typing.

Use iterative option of Excel.

Calculate the ith component during the ith iteration. Save for use later.

Page 8: Spectral Analysis Using Excel - CSAAPTcsaapt.org/uploads/3/4/4/2/34425343/csaapt_tran_2017.pdf · Spectral analysis of sound from a guitar. Applications of Fourier Transform Signal

Data

Window

Data × window

cos (nti)

sin (nti)

ti

Page 9: Spectral Analysis Using Excel - CSAAPTcsaapt.org/uploads/3/4/4/2/34425343/csaapt_tran_2017.pdf · Spectral analysis of sound from a guitar. Applications of Fourier Transform Signal

Be Careful

Excel calculates from left to right and top down for each iteration.

So make sure instructions are in the correct order.

Page 10: Spectral Analysis Using Excel - CSAAPTcsaapt.org/uploads/3/4/4/2/34425343/csaapt_tran_2017.pdf · Spectral analysis of sound from a guitar. Applications of Fourier Transform Signal

Not FFT

Can program to do FFT.

But too complex, and the gain in computation time for the data size is not worth it.

Page 11: Spectral Analysis Using Excel - CSAAPTcsaapt.org/uploads/3/4/4/2/34425343/csaapt_tran_2017.pdf · Spectral analysis of sound from a guitar. Applications of Fourier Transform Signal

Tuning Fork (384 Hz)

-1.00

-0.80

-0.60

-0.40

-0.20

0.00

0.20

0.40

0.60

0.80

1.00

1.20

0 200 400 600 800 1000 1200

F(t)

Index

F(t)

F(t)

Window W(t)

F(t)W(t)

0.0000

0.0100

0.0200

0.0300

0.0400

0.0500

0.0600

0.0700

0.0800

0 100 200 300 400 500 600

F(w

)

Index

F(w)

384.8Hz

Page 12: Spectral Analysis Using Excel - CSAAPTcsaapt.org/uploads/3/4/4/2/34425343/csaapt_tran_2017.pdf · Spectral analysis of sound from a guitar. Applications of Fourier Transform Signal

Usual Standing Wave Experiment

Wouldn’t it be more interesting to do an experiment with a musical instrument?

Page 13: Spectral Analysis Using Excel - CSAAPTcsaapt.org/uploads/3/4/4/2/34425343/csaapt_tran_2017.pdf · Spectral analysis of sound from a guitar. Applications of Fourier Transform Signal

Standing Wave on a Guitar

-1.50

-1.00

-0.50

0.00

0.50

1.00

1.50

2.00

2.50

0 200 400 600 800 1000 1200

F(t)

Index

F(t)

F(t)

Window W(t)

F(t)W(t)

0.0000

0.0050

0.0100

0.0150

0.0200

0.0250

0.0300

0.0350

0.0400

0.0450

0.0500

0 100 200 300 400 500 600

F(w

)

Index

F(w)

Fundamental

2nd harmonic

3rd harmonic

4th harmonic

Page 14: Spectral Analysis Using Excel - CSAAPTcsaapt.org/uploads/3/4/4/2/34425343/csaapt_tran_2017.pdf · Spectral analysis of sound from a guitar. Applications of Fourier Transform Signal

Frequency vs 1/Length

y = 56x - 4.5R² = 1.0

80

90

100

110

120

130

140

1.5 1.6 1.7 1.8 1.9 2 2.1 2.2 2.3 2.4

Freq

uen

cy (

Hz)

1/L (m-1)

Fundamental frequency v 1/length

Page 15: Spectral Analysis Using Excel - CSAAPTcsaapt.org/uploads/3/4/4/2/34425343/csaapt_tran_2017.pdf · Spectral analysis of sound from a guitar. Applications of Fourier Transform Signal

Frequency vs Wave Speed

y = 0.94x - 17R² = 0.99

0

20

40

60

80

100

120

140

100 110 120 130 140 150

Freq

uen

cy (

Hz)

Speed (m/s)

Frequency vs Wave Speed

Page 16: Spectral Analysis Using Excel - CSAAPTcsaapt.org/uploads/3/4/4/2/34425343/csaapt_tran_2017.pdf · Spectral analysis of sound from a guitar. Applications of Fourier Transform Signal

Strength vs Time

0

10

20

30

40

50

60

0 0.1 0.2 0.3 0.4 0.5

Stre

ngt

h

Time (s)

Strength vs time

Fundamental

2nd harmonic

3rd harmonic

4th harmonic

Page 17: Spectral Analysis Using Excel - CSAAPTcsaapt.org/uploads/3/4/4/2/34425343/csaapt_tran_2017.pdf · Spectral analysis of sound from a guitar. Applications of Fourier Transform Signal

What Else?

Pluck the string at different positions to see how that affects the composition of the

different harmonics.

Page 18: Spectral Analysis Using Excel - CSAAPTcsaapt.org/uploads/3/4/4/2/34425343/csaapt_tran_2017.pdf · Spectral analysis of sound from a guitar. Applications of Fourier Transform Signal

Benefits Over Old Experiment

Students can see how physics works in a real life application.

Teach the principle of superposition of waves.

Page 19: Spectral Analysis Using Excel - CSAAPTcsaapt.org/uploads/3/4/4/2/34425343/csaapt_tran_2017.pdf · Spectral analysis of sound from a guitar. Applications of Fourier Transform Signal

Difficulty

We only have one guitar.

Solution: ask students to bring in their own if they have one.

Page 20: Spectral Analysis Using Excel - CSAAPTcsaapt.org/uploads/3/4/4/2/34425343/csaapt_tran_2017.pdf · Spectral analysis of sound from a guitar. Applications of Fourier Transform Signal

Thank you