[Tutor] fourier transform

Jeff Peery 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:
 
.
.
.
-0.498 1
0.0 2
-0.498 3
0.0 4
-0.498 5
0.0 6
-0.498 7
0.0 8
-0.498 9
0.0 10
-0.498 11
0.0 12
-0.498 13
0.0 14
-0.498 15
0.0 16
-0.498 17
.
.
.
 
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?

Hi Jeff,

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 numarrayl.)
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!

Cheers
Christian

_______________________________________________
Tutor maillist - Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050801/87fc45fd/attachment.htm


More information about the Tutor mailing list