Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: help understanding FFT results (Read 5142 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

help understanding FFT results

as a newcomer to this stuff, i've just got a couple of questions about understanding the results of a fourier transform:

what does a negative result for the amplitude of a frequency mean? should just the magnitude of the amplitude for each bin be used (for simple audio analysis)?

what range of results should i get if the range of my time domain samples is -1 to 1, and how do i change this to dBFS (just 20logx?)

is taking a number of fft windows and averaging the results equivelent to taking one larger window? i.e. is the average of 8 windows of 2048 samples the same as 1 window of 16384?

thanks for any help.

help understanding FFT results

Reply #1
Quote
what range of results should i get if the range of my time domain samples is -1 to 1, and how do i change this to dBFS (just 20logx?)


Depends on the scaling used.

Quote
is taking a number of fft windows and averaging the results equivelent to taking one larger window? i.e. is the average of 8 windows of 2048 samples the same as 1 window of 16384?
thanks for any help.
[a href="index.php?act=findpost&pid=351688"][{POST_SNAPBACK}][/a]


One will give you 2048 outputs, the other 16384. How can they be equivalent?

help understanding FFT results

Reply #2
Quote
Depends on the scaling used.

where does this scaling generally take place? do you mean the 1/rootN which is sometimes in front of the equation? i'm talking about an un-normalized transform...

Quote
One will give you 2048 outputs, the other 16384. How can they be equivalent?
[a href="index.php?act=findpost&pid=351694"][{POST_SNAPBACK}][/a]

of course! sorry for being a bit slow there. so i suppose my question should be would they be the same other than the resolution (would the resulting spectrums look the same?)

or, more importantly - if you were planning on taking the average of many windows of an fft, would it be much better to just take one big window (better frequency resolution?)



any idea about these negative amplitudes i'm getting out of FFTW? i think i read that the transform of a pure sine wave is negative and a pure cosine is positive. i'm looking for a not-too-mathematical explanation of why this happens..

help understanding FFT results

Reply #3
Quote
Quote
Depends on the scaling used.

where does this scaling generally take place?
do you mean the 1/rootN which is sometimes in front of the equation? i'm talking about an un-normalized transform...


I don't think there's such a thing as a standard place to do the scaling. It's a natural property of the FFT/IFFT.

An unnormalized transform will have output values whose magnitude is a function of the input data size.


Quote
Quote
One will give you 2048 outputs, the other 16384. How can they be equivalent?
[a href="index.php?act=findpost&pid=351694"][{POST_SNAPBACK}][/a]

of course! sorry for being a bit slow there. so i suppose my question should be would they be the same other than the resolution (would the resulting spectrums look the same?)

or, more importantly - if you were planning on taking the average of many windows of an fft, would it be much better to just take one big window (better frequency resolution?)


I think averaging will probably work fine if you just want the power. I don't know offhand if the mathematics would work out the same.

The important factor is probably that doing 8 * (N log N) operations is faster than 8*N log 8*N, so doing multiple small FFT's faster.

Quote
any idea about these negative amplitudes i'm getting out of FFTW? i think i read that the transform of a pure sine wave is negative and a pure cosine is positive. i'm looking for a not-too-mathematical explanation of why this happens..
[a href="index.php?act=findpost&pid=351701"][{POST_SNAPBACK}][/a]


I don't think I can explain it well. But you want to consider the outputs as complex numbers, and take their magnitude.

There are other pitfalls. Check the Numerical Recipes book, they have a good description of the methods and issues.

help understanding FFT results

Reply #4
Quote
any idea about these negative amplitudes i'm getting out of FFTW? i think i read that the transform of a pure sine wave is negative and a pure cosine is positive. i'm looking for a not-too-mathematical explanation of why this happens..
[a href="index.php?act=findpost&pid=351701"][{POST_SNAPBACK}][/a]


Negative amplitude?  Are we talking about the magnitude of the complex output?

help understanding FFT results

Reply #5
More like the real part I'd guess.

help understanding FFT results

Reply #6
If you're seeing negative values, then you're probably look at the individual real and imaginary coefficients.  In non-mathematical terms, you'll get negative values for sine and/or cosine response depending on the phase of your input compared to the window length.  For simple audio analysis, you probably want the magnitude anyway [sqrt(real^2+imag^2)], and the negatives will go away.

help understanding FFT results

Reply #7
Quote
For simple audio analysis, you probably want the magnitude anyway [sqrt(real^2+imag^2)], and the negatives will go away.
[a href="index.php?act=findpost&pid=351794"][{POST_SNAPBACK}][/a]

ok, thanks