Geol 491: Spectral Analysis tom.wilson@mail.wvu.edu N 1 H n hk e 2ikn N k 0 1 N 1 hk H n e 2ikn N N n 0 Introduction to Fourier series and Fourier transforms Fourier said that any single valued function could be reproduced as a sum of sines and cosines 8 5*sin (24t) 6 Amplitude = 5 4 Frequency = 4 Hz 2 0 -2 -4 -6 -8 0 0.1 0.2 0.3 0.4 0.5 0.6 seconds 0.7 0.8 0.9 1 We are usually dealing with sampled data 8 5*sin(24t) 6 Amplitude = 5 4 Frequency = 4 Hz 2 Sampling rate = 256 samples/second 0 -2 Sampling duration = 1 second -4 -6 -8 0 0.1 0.2 0.3 0.4 0.5 0.6 seconds 0.7 0.8 0.9 1 Faithful reproduction of the signal requires adequate sampling sin(28t), SR = 8.5 Hz 2 1.5 1 0.5 0 -0.5 -1 -1.5 -2 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 If our sample rate isn’t high enough, then the output frequency will be lower than the input, The Nyquist Frequency • The Nyquist frequency is equal to one-half of the sampling frequency. • The Nyquist frequency is the highest frequency that can be measured in a signal. f Ny 1 2 t Where t is the sample rate Frequencies higher than the Nyquist frequencies will be aliased to lower frequency The Nyquist Frequency Thus if t = 0.004 seconds, fNy = f Ny 1 2 t Where t is the sample rate Fourier series: a weighted sum of sines and cosines • Periodic functions and signals may be expanded into a series of sine and cosine functions f (t ) a0 a1 cos t b1 sin t a2 cos 2t b2 sin 2t a3 cos 3t b3 sin 3t ... +... This applet is fun to play with & educational too. Experiment with http://www.falstad.com/fourier/ Try making sounds by combining several harmonics (multiples of the fundamental frequency) An octave represents a doubling of the frequency. 220Hz, 440Hz and 880Hz played together produce a “pleasant sound” Frequencies in the ratio of 3:2 represent a fifth and are also considered pleasant to the ear. 220, 660, 1980etc. Pythagoras (530BC) You can also observe how filtering of a broadband waveform will change audible waveform properties. http://www.falstad.com/dfilter/ Fourier series • The Fourier series can be expressed more compactly using summation notation f (t ) a0 an cos nt bn sin nt n 1 You’ve seen from the forgoing example that right angle turns, drops, increases in the value of a function can be simulated using the curvaceous sinusoids. Fourier series • Try the excel file step2.xls f (t ) a0 an cos nt bn sin nt n 1 The Fourier Transform • A transform takes one function (or signal) in time and turns it into another function (or signal) in frequency • This can be done with continuous functions or discrete functions f (t ) a0 an cos nt bn sin nt n 1 The Fourier Transform • The general problem is to find the coefficients: a0, a1, b1, etc. f (t ) a0 an cos nt bn sin nt n 1 Take the integral of f(t) from 0 to T (where T is 1/f). Note =2/T 1 T f (t )dt 0 T What do you get? Looks like an average! We’ll work through this on the board. Getting the other Fourier coefficients To get the other coefficients consider what happens when you multiply the terms in the series by terms like cos(it) or sin(it). f (t ) cos it a0 cos it a1 cos t cos it b1 sin t cos it a2 cos 2t cos it b2 sin 2t cos it a3 cos 3t cos it b3 sin 3t cos it ... +... ai cos it cos it bi sin it cos it ... +... Now integrate f(t) cos(it) T 0 T f (t ) cos itdt (a0 cos it a1 cos t cos it b1 sin t cos it 0 a2 cos 2t cos it b2 sin 2t cos it a3 cos 3t cos it b3 sin 3t cos it ... +... ai cos it cos it bi sin it cos it ... T 0 +... ) dt a0 cos itdt 0 This is just the average of i periods of the cosine Now integrate f(t) cos(it) T 0 a1 cos t cos itdt ? Use the identity 1 1 cos A cos B cos( A B) cos( A B) 2 2 If i=2 then the a1 term = a1 a1 cos t cos t (cos 2t cos 0) 2 T 0 a1 cos t cos tdt T 0 T a a1 cos 2tdt 1 cos 0dt 0 2 2 What does this give us? T 0 a1 a1 cos t cos tdt 0 2 T 0 And what about the other terms in the series? T 0 a2 cos 2t cos tdt T 0 T a a2 cos 3tdt 2 costdt 0 2 2 In general to find the coefficients we do the following 1 T a0 f (t )dt T 0 2 T an f (t ) cos ntdt T 0 and 2 T bn f (t ) sin ntdt T 0 The a’s and b’s are considered the amplitudes of the real and imaginary terms (cosine and sine) defining individual frequency components in a signal Arbitrary period versus 2 Sometimes you’ll see the Fourier coefficients written as integrals from - to 1 a0 2 an 1 f (t )dt f (t ) cos ntdt and bn 1 f (t ) sin ntdt Exponential notation cost is considered Re eit where ent cos t i sin t The Fourier Transform • A transform takes one function (or signal) and turns it into another function (or signal) • Continuous Fourier Transform: H f h t e 2ift dt h t H f e 2ift df The Fourier Transform • A transform takes one function (or signal) and turns it into another function (or signal) • The Discrete Fourier Transform: N 1 H n hk e 2ikn N k 0 1 N 1 hk H n e 2ikn N N n 0 Some useful links • • • • • • http://www.falstad.com/fourier/ – Fourier series java applet http://www.jhu.edu/~signals/ – Collection of demonstrations about digital signal processing http://www.ni.com/events/tutorials/campus.htm – FFT tutorial from National Instruments http://www.cf.ac.uk/psych/CullingJ/dictionary.html – Dictionary of DSP terms http://jchemed.chem.wisc.edu/JCEWWW/Features/McadInChem/mcad008/ FT4FreeIndDecay.pdf – Mathcad tutorial for exploring Fourier transforms of free-induction decay http://lcni.uoregon.edu/fft/fft.ppt – This presentation Meeting times?