22.05.2014 Views

Topic 2: The pendulum

Topic 2: The pendulum

Topic 2: The pendulum

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

PHY321F — cp 2005 36<br />

...<br />

F=fft(f) # f is a Numeric array<br />

g=inverse_fft(F)<br />

Note that F and g will be complex.<br />

Application of the FFT is complicated slightly by the conventions used to<br />

structure the data (Note that these are not peculiar to Python).<br />

Suppose that the initial data f(t) is in the time domain, with N points at<br />

a spacing δt, with T = Nδt. <strong>The</strong> transformed data F (ω) is (a) complex,<br />

and (b) runs over the range −(N/2)δω . . . (N/2)δω, with δω = 2π/T . In<br />

addition, the values coresponding to positive frequencies are returned in the<br />

first half of the array, while those at negative frequencies in the second half of<br />

the array. If the initial data has negative times, the same convention should<br />

be applied.<br />

E.6 Uses of the FFT<br />

<strong>The</strong>re are a number of applications of the FFT, based on various theorems<br />

on Fourier transforms.<br />

E.6.1<br />

Power spectrum<br />

<strong>The</strong> power spectrum gives essentially the intensity of the time-domain data<br />

as a function of frequency.<br />

It is defined by<br />

and may be computed by<br />

P (ω) = |F (ω)| 2<br />

transform=fft(data) # transform is complex<br />

powerspectrum=abs(transform*conjugate(transform))/len(data)**2<br />

A single frequency in the data will result in a delta function in the power<br />

spectrum. However, the FFT is always applied to a finite domain, and this<br />

causes ‘power’ to leak to adjacent frequencies. Hence the delta function is

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!