16
$\begingroup$

I performed 512 point FFT on a signal. I got another set of 512 Numbers. I understand that those numbers represent amplitude of the various sine and cosine waves having different frequencies.

If my understanding is correct can somebody tell me how to know the frequencies of those sine and cosine waves from the knowledge of those 512-numbers (i.e amplitudes) ?

$\endgroup$

4 Answers 4

20
$\begingroup$

Assuming your 512 samples of the signal are taken at a sampling freqeuncy $f_s$, then the resulting 512 FFT coefficients correspond to frequencies:

0, $f_s/512$, $2 f_s/512$, $\ldots$, $511 f_s/512$

Since you are dealing with discrete-time signals, Fourier transforms are periodic, and FFT is no exception.

Therefore you can think of your last coefficient as corresponding also to frequency $511 f_s/512 = (511-512) f_s/512 = -1 f_s/512$.

The same applies to the second to last coefficient, and so on. This is the mirroring commented by Daniel Hicks.

Also, if you are transforming a real signal, then all your information is contained in the first 256 FFT coefficients. The rest are simply complex conjugates of the first coefficients.

$\endgroup$
7
$\begingroup$

It always makes my head hurt, but first understand that you have only 256 frequencies. Depending on the algorithm used, the second 256 are just a mirror of the first or they represent the imaginary components corresponding to the real components in the first 256.

Also understand that frequency resolution of an FFT only goes up to half the sampling frequency, so if you were sampling at 10,000 samples per second, the highest frequency resolved will be 5,000 Hz.

From there you can kind of figure it out. Say you've got 256 buckets, the highest representing 5000Hz and the lowest representing DC. Each bucket is 5000/256 Hz of spectrum width, so the zeroeth starts at DC, the first starts at 19.5Hz, the second at 39Hz, etc.

Anyway, that's the way I've always figured it out.

$\endgroup$
7
$\begingroup$

First, the FFT coefficients you get are not broken down into 256 sine and 256 cosine coefficients. These are the coefficients of the complex exponentials your signal is made of. If your input signal is real, only 257 of those coefficients are carrying useful information (DC component ; 255 components ; nyquist frequency component ; then the conjugate of the 255 components, the only information they carry is that your signal has a null imaginary part). The modulus of the coefficient carry amplitude information, the angle carry phase information, the real part cosine amplitude and the imaginary part sine amplitude ; and a component at index $i$ contain information about frequency $\frac{i}{N}{s_r}$ where $N$ is the FFT size and $s_r$ your sample rate.

$\endgroup$
1
$\begingroup$

Juancho answers the question, but I feel I should point out on further discussion that in general the input to the DFT/FFT is not strictly real, and therefore, the negative- or greater than Nyquist- frequencies contain information other than a conjugate of the Fs/2 data.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.