## FFT basic question

7 posts / 0 new
Author
Message

Hi Guys,

It's been a while since I looked at the FFT in detail so I have a basic question.

What information do you need to plot the FFT of a signal?
Sampling frequency
How many samples (N)

What else?

I am capturing some real time ADC data through an AVR and want to plot the FFT of this signal. I know (somewhat) my sampling frequency and number of samples in one cycle of the wave. I am getting about 28 samples in one cycle of a 1Khz sine wave which means my sampling frequency is 28 ksps.

I am starting with a known sine wave input of known frequency to test my FFT and then proceed to a real life signal.
Thanks.

Total votes: 0

Total votes: 0

Looks like all FFT roads lead to elm-chan. :)

I have seen that site before and will look at it once more.

So looks like all I need is sampling frequency and number of FFT points = number of samples in one cycle of a periodic wave?

Total votes: 0

You need to sample for one period of the lowest frequency of interest, at a rate twice the highest frequency of interest. Lets say you are interested in voice band maybe 125 to 4000... so you need to sample for 8ms at 8khz... 64 samples.... 125hz spacing. You get real and imaginary ampl and phase every 125 hz. 64 lines gets you from 0 to 8000, but the top half is the same as the bottom half, so you get 32 spectra 125 hz apart from 0 to 4000. Get the magnitude of the re and im parts at ea line and convert to db.

Imagecraft compiler user

Total votes: 0

So for example if I had 256 samples of a signal with sampling frequency of say 10 ksps, my lowest frequency would be about 39 Hz? (10000/256)

Total votes: 0

You have to talk about a "sample window" of N samples. You REALLY want N to be 2**J, where J is a positive integer. That is, 16, 32, 64, etc.

If you just take the samples over the raw window, you will get some strange effects that decrease slowly as the number of samples in the window increases. These effects can be reduced by "weighting" the samples near the edged of the window. There are a number of styles of weighting. You MAY be able to get by without doing this, but be prepared for some things that you might not expect.

Jim

Until Black Lives Matter, we do not have "All Lives Matter"!

Total votes: 0

Has anyone actually used the elm-chan library and verified its correctness? I tried making some minor tweaks to use a different windowing function and cut out the square root calculation (for speed purposes) and the whole thing seems to break down. Actually comparing the windowed data after fft_input executes looks wrong when comparing its results to another FFT implementation using the same window.

Best I can tell is that the FMULS16 routine is wrong, but I'd be interested in hearing about the experiences of others.