<DIV>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?</DIV>
<DIV> </DIV>
<DIV>thanks.<BR><BR><B><I>Pawel Kraszewski <Pawel_Kraszewski@wp.pl></I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">> Hello, I have a signal that I want to do a fourier transform on. I tried<BR>> using FFT.fft(data).real but I don't understand the output. what is output<BR>> from this function, and why doesn't it require amplitude and time as<BR>> inputs?<BR><BR>Please write the package you use for FFT. Standard Python doesn't have one. <BR>Perhaps you use some custom Python? Like Enthought Python? If so, the <BR>exhaustive guide is delivered with it in CHM (windows help) format.<BR><BR>1. In general FFT algorithms require you to supply just N complex values <BR>(complex contains both amplitude and phase of signal). If you supply real <BR>values, the system assumes phase=0 for each sample and takes given value for <BR>amplitude.<BR><BR>2. You DO supply a time information, you just didn't think of it this way: <BR>each consecutive sample is taken one fixed clock tick later, so position
of <BR>sample in data gives you the time it was taken.<BR><BR>3. Results of FFT are in the form of complex vector of the same length as <BR>data. Starting from position 0 it gives you an constant (DC factor), position <BR>1 an amplitude and phase (remember - complex number gives you both amplitude <BR>and phase) of wave of the length table/2 and so on. If you take real value of <BR>this, you discard part of the information. AFAIR - taking real part gives you <BR>sine component, taking imaginary part gives you cosine component, taking <BR>absolute value gives you total amplitude and taking angle gives you phase.<BR><BR>4. The answer is symmetrical - usually you take only half of it. I don't <BR>remember the exact difference between the halves, but you may find it in any <BR>article on FFT.<BR><BR>Best regards,<BR>Pawel Kraszewski<BR>_______________________________________________<BR>Tutor maillist - Tutor@python.org<BR>http://mail.python.org/mailman/listinfo/tutor<BR></BLOCKQUOTE>