The Cyber-Spy.Com Usenet Archive Feeds Directly
From The Open And Publicly Available Newsgroup
This Group And Thousands Of Others Are Available
On Most IS NNTP News Servers On Port 119.
Cyber-Spy.Com Is NOT Responsible For Any Topic,
Opinions Or Content Posted To This Or Any Other
Newsgroup. This Web Archive Of The Newsgroup And
Posts Are For Informational Purposes Only.
From: Chuck Simmons
Organization: You jest.
X-Mailer: Mozilla 4.61 [en] (X11; U; Linux 2.0.33 i586)
Subject: Re: fft in hc11 again
Date: Sat, 12 Oct 2002 19:21:07 GMT
NNTP-Posting-Date: Sat, 12 Oct 2002 12:21:07 PDT
john jardine wrote:
> firstname.lastname@example.org (Albert Leng) wrote in message news:...
> > I've posted question about the fft routine i obtained from motorola
> > bbs. Thanks for all your help.
> > I'm using EVM to work on the project and i have written the "sampling"
> > code to sample data from a sine wave. The fft routine is too
> > complicated for a newbie like me. I'm facing
> > difficulty in passing the sampled data into the fft routine and
> > display
> > the reults from the routine. I mean i dont know where the routine
> > store the results and how the routine relates to the fft except the
> > "bit reversal" part.
> > I really hope that you can send me your source code (if you have) with
> > some simple comments or just give me some advice. So, perhaps i can
> > understand more about
> > the fft routine and how everything works.
> > Thanks for your time and your help.
> Unfortunately the FFT is one of those areas where those 'in the know'
> make no effort to explain it to mere mortals.
> I don't know this particular Motorola routine but all the ones I've
> come across expect the input data samples to be held in a single fixed
> array of say 512 or 1024 or 2048 ect, ect, locations. This is simply
> the storage array that you have just filled up with your samples.
> Before a run, the FFT routine will also expect for there to be a
> *second* identically sized (empty) storage array available, for it to
> fill up with the results of its final 'phase' calculations.
> The routine you have may call them something like real() imag().
> The FFT routine also needs to be told the number of your samples it
> will be chewing on. The 'n'.
> So before you start you need your 'n' point sine wave data array plus
> an empty 'n' point 'final phase results' storage array.
> The FFT can then work it's magic with its bit twiddling and Cos/Sin
> calculation stuff.
> The result of the FFT will be to fill up *both* these arrays with
> wierd numbers.
> Your original sample array has been backfilled with the 'real' part
> of your sinewave's frequency spectrum and the data in the second array
> is filled with the phase shifted or 'quadrature' or 'imaginary' part
> of the sine waves frequency spectrum. The FFT routine has now
> finished as it has done its job
> There is still more to do though ... The FFT numbers in the arrays are
> pretty much useless on their own, so your next step is to run through
> both arrays point by point and do the triangle hyponuse calc
> sqr(a^2+b^2) and put the result back (in say) the original array.
> These 'n' numbers are the actual frequency spectrum components or
> voltages (harmonics ect) of you original samples.
> The top half of the the spectrum data array is a mirror image of the
> bottom half. It's useless so ignore it.
> If you originally had say an array of 512 samples representing a
> single cycle of a 1kHz distorted sinewave then the final data will
> represent all the frequency components in that sinewave up to 256kHz.
> Each array location holding a single harmonic frequency of the
> fundemental. (btw, the first location holds the average DC value of
> your input data)
> If you manage to get this far and can display your final data, then
> don't be put off by the numerous spectral components or 'lines' that
> can turn up. Also don't be surprised if your perfect 1kHz input
> sinewave turns up as if smeared over a number of nearby frequencies.
> This is related to how 'clean' the start and end points were of your
> samples and leads to another story concerning massaging or 'windowing'
> the data before you process it.
> (A normal spectrum analyser doesn't suffer this as it works with a
> continuous ac signal)
> Most of the FFT descriptions out there are by maths people for maths
> therefore understanding the details of the FFT can lead to a career in
> itself. Best source I've come across is the excellent (and free!)
> download from www.dspguide.com.
> Chapter 12 page 235 has an good FFT example programme written in
About time someone said something sensible about the FFT algorithms. In
particular pointing out limitations and problems. The difficulties with
FFT are great enough that the FFT function in Matlab usually does an
ordinary DFT instead unless the buffer size is fudged to force
conditions under which FFT is just as accurate. Generally, the FFT is
only preferable when computational cycles are at a premium. In that
case, all of the horrors of windowing and other spectral distorions can
be tolerated in order to get the job done. If speed is not an issue,
ordinary DFT methods are safer numerically.
... The times have been,
That, when the brains were out,
the man would die. ... Macbeth
Chuck Simmons email@example.com
Go Back To The Cyber-Spy.Com
Usenet Web Archive Index Of
The sci.electronics.design Newsgroup