[Tutor] fourier transform

Jeff Peery jeffpeery at yahoo.com
Tue Aug 2 00:38:43 CEST 2005


ok, this makes more sense. what I want to know is the amplitude for the output frequencies. I'm using import FFT, and FFT.fft(). the first element of the output is the DC constant? not sure what this is. is the amplitude for all other elements plus the DC equal to the actual amplitude?
 
thanks.

Pawel Kraszewski <Pawel_Kraszewski at wp.pl> 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?

Please write the package you use for FFT. Standard Python doesn't have one. 
Perhaps you use some custom Python? Like Enthought Python? If so, the 
exhaustive guide is delivered with it in CHM (windows help) format.

1. In general FFT algorithms require you to supply just N complex values 
(complex contains both amplitude and phase of signal). If you supply real 
values, the system assumes phase=0 for each sample and takes given value for 
amplitude.

2. You DO supply a time information, you just didn't think of it this way: 
each consecutive sample is taken one fixed clock tick later, so position of 
sample in data gives you the time it was taken.

3. Results of FFT are in the form of complex vector of the same length as 
data. Starting from position 0 it gives you an constant (DC factor), position 
1 an amplitude and phase (remember - complex number gives you both amplitude 
and phase) of wave of the length table/2 and so on. If you take real value of 
this, you discard part of the information. AFAIR - taking real part gives you 
sine component, taking imaginary part gives you cosine component, taking 
absolute value gives you total amplitude and taking angle gives you phase.

4. The answer is symmetrical - usually you take only half of it. I don't 
remember the exact difference between the halves, but you may find it in any 
article on FFT.

Best regards,
Pawel Kraszewski
_______________________________________________
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/35cf86b7/attachment.htm


More information about the Tutor mailing list