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: Ken Smith
Subject: Re: fft in hc11 again
Date: Tue, 15 Oct 2002 15:30:20 +0000 (UTC)
Organization: a2i network
NNTP-Posting-Date: Tue, 15 Oct 2002 15:30:20 +0000 (UTC)
In article <email@example.com>,
john jardine wrote:
>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.
Many FFT routines require that you put you input data into an array of
complex numbers. Basically you put the ADC values in every second
location and a zero in the ones between.
Not all FFT routines need a second location. They can to the FFT in place
and leave the results in the array the data was in.
You get out the same number of meaningful values as you put in. For every
frequency other than DC and Nyquist, you get two values. For DC and
Nyquist, you get only one value each.
>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.
"sqrt" means square-root here. If you have to make the result in dB
you can skip the sqrt() step and go straight into the
log() calculation. Remember log(sqrt(X)) = 0.5log(X).
BTW: Don't worry too much about the log() function if you don't have
one. It is surprisingly easy to make one good enough for display
purposes. The way I did it was to shift the value up or down until it is
in the 128-256 range and then use the 8 bits to look in a table. The
number of shifts gives the integer part of the log2() the table gives the
fractional part. Once you have log2() you can just multiply by a constant
to get log10(). You have to multiply by a constant anyway to scale it for
display so just combine the constants and do one multiply.
>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)
Also remember 1KHz != 1KHz if they come from different crystals. Things
look a lot better if you apply a window function as suggested. It helps
to mask the effects of slip between the clocks.
firstname.lastname@example.org forging knowledge
Go Back To The Cyber-Spy.Com
Usenet Web Archive Index Of
The sci.electronics.design Newsgroup