[Tutor] fourier transform
jeffpeery at yahoo.com
Tue Aug 2 00:01:24 CEST 2005
thanks for the help. I think I'm understanding this a bit better. although I still don't completely understand the output. here is an example... for the input I have 1024 samples taken from a 1 Hz square wave with amplitude = 1. for the output I would expect an infinite number of frequencies. the output from FFT.fft(myData).real is this:
I'm not sure why the output alternates from 0 and 0.498. I would expect 0.498 at all frequencies? why the oscillation?
Christian Meesters <meesters at uni-mainz.de> wrote:
Jeff Peery wrote:
> Hello, I have a signal that I want to do a fourier transform on. I
> tried using FFT.fft(data).real but I don't understand the output.
> what is output from this function, and why doesn't it require
> amplitude and time as inputs?
As Danny wrote, your input are real numbers and your output will be
complex numbers. I don't want to point you to the numarray
documentation once more, but you might to check out this:
http://mathworld.wolfram.com/FourierSeries.html as for why you get
complex numbers back. (To get only the real value part try real_fft()
In general in numerical computation your input is simply a series of
real numbers - of equal spacing in the dimension you want to consider.
Which dimension you choose (amplitudes and time/phase or amplitudes and
spacial frequencies and so on) is up to you. It depends on your
physical or mathematical question. IMHO the best introduction you can
get on Fourier Transforms & programming can be found in Numerical
Recipies (here the "Numerical Recipies in C"-link
http://www.library.cornell.edu/nr/bookcpdf.html - check chapter 12).
Have fun with FFTs!
Tutor maillist - Tutor at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor