From: Robert Baer
X-Mailer: Mozilla 4.75 [en] (Win98; U)
Subject: Re: fft in hc11
Date: Wed, 09 Oct 2002 07:45:28 GMT
NNTP-Posting-Date: Wed, 09 Oct 2002 00:45:28 PDT
Organization: EarthLink Inc. -- http://www.EarthLink.net
Albert Leng wrote:
> I'm new to hc11 and have to do a project in hc11 performing fft to
> calculate the total harmonic distortion present in the signal.
> I have looked through the operation of FFT which consists of
> 1) Bit Reversal Data Sorting
> 2) Decompose an N point time domain signal into N signals each containing
> a single point
> 3) Find the spectrum of each of the N point signals
> 4) Synthesize the N frequency spectra into a single frequency spectrum
> After studying through the code "fft routine" from motorola, i really
> have no idea what the code is about. Can you please give me some ideas on
> how the code relates to the above 4 steps and how i can set the A/D for
> the inputs? Also, how can i calculate the average of the each frequency
> amplitude presented?
> Thanks for your time. Really hoe to get your reply soon.
Well, you do not exactly have it described correctly, but you are not
too far off.
N samples of a signal, equally divided in time can be used via the FFT
to get a 2N point (N real and N complex) frequency spectrum.
Now if N is a power of two, the FFT is optimised. If not, filler zeros
can be used, or the regular Fourier Transform can be used.
In all events, the (power of two FFT) algorithm starts with N data
points and N zeros, and results with N real (amplitude) and N complex
(phase) data points.
If all you are trying to do is convert time data to frequency data (or
vice-versa, as the inverse transform is basically identical), then one
can safely ignore the internals of the algorithm.
If you are concerned with maximizing the speed, then the algorithm
can, in most cases, be greatly improved.
I have seen many FFT algorithms and the variant Fast Hartley Transform
algorithms, and only David H. Bailey has FFT transforms superior in
speed to my FFT transforms.
So if the transform is written by anyone else, or is not a modern
FORTRAN-90 version by Mr. Bailey, i can guarantee you that there is some
room (and perhaps a lot) for speed improvement.
If you take these N samples of a repetitive waveform M times, then
average the data points before the FFT; the result will give an