我如何获得在FFT每个值的频率? [英] How do I obtain the frequencies of each value in an FFT?

查看:271
本文介绍了我如何获得在FFT每个值的频率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个FFT结果。这些被存储在两个双击数组:实部阵列和虚部数组。如何确定对应于每个元素在这些阵列的频率?

在换言之,我想有创建一个存储的频率为我的FFT的每个实部和虚分量的阵列。


解决方案

在FFT的第一格为直流(0赫兹),第二个箱子是 FS / N ,其中 FS 是采样率和 N 是FFT的大小。下一个纸槽 2 * Fs的/ N 。给前preSS这笼统地说,第n 的纸槽 N * Fs的/ N

所以,如果你的采样率, FS 是说44.1 kHz和您的FFT的大小, N 是1024,那么在FFT出纸槽是在:

  0:0 *一千零二十四分之四万四千百= 0.0赫兹
  1:1 *一千零二十四分之四万四千百= 43.1赫兹
  2:2 *一千零二十四分之四万四千百= 86.1赫兹
  3:3 *一千零二十四分之四万四千百= 129.2赫兹
  4:...
  5:...
     ...
511:511 *一千零二十四分之四万四千百= 22006.9赫兹

请注意,对于一个真正的输入信号(虚部全部零)FFT下半年(从箱N / 2 + 1 N - 1 )不包含任何有用的附加信息(它们与第一个 N / 2复共轭对称 - 1 箱)。最后有用槽(用于实际aplications)是在 N / 2 - 1 ,其对应于在上面的例子22006.9赫兹。在 N / 2 重新presents能在奈奎斯特频率仓,即 FS / 2 (= 22050赫兹在本实施例),但是这是在一般的不任何实际使用中,由于抗混叠滤波器将通常在与上述 FS / 2 衰减的任何信号。

I have an FFT result. These are stored in two double arrays: a real part array and an imaginary part array. How do I determine the frequencies that correspond to each element in these arrays?

In other words, I would like have create an array that stores the frequencies for each real and imaginary component of my FFT.

解决方案

The first bin in the FFT is DC (0 Hz), the second bin is Fs / N, where Fs is the sample rate and N is the size of the FFT. The next bin is 2 * Fs / N. To express this in general terms, the nth bin is n * Fs / N.

So if your sample rate, Fs is say 44.1 kHz and your FFT size, N is 1024, then the FFT output bins are at:

  0:   0 * 44100 / 1024 =     0.0 Hz
  1:   1 * 44100 / 1024 =    43.1 Hz
  2:   2 * 44100 / 1024 =    86.1 Hz
  3:   3 * 44100 / 1024 =   129.2 Hz
  4: ...
  5: ...
     ...
511: 511 * 44100 / 1024 = 22006.9 Hz

Note that for a real input signal (imaginary parts all zero) the second half of the FFT (bins from N / 2 + 1 to N - 1) contain no useful additional information (they have complex conjugate symmetry with the first N / 2 - 1 bins). The last useful bin (for practical aplications) is at N / 2 - 1, which corresponds to 22006.9 Hz in the above example. The bin at N / 2 represents energy at the Nyquist frequency, i.e. Fs / 2 ( = 22050 Hz in this example), but this is in general not of any practical use, since anti-aliasing filters will typically attenuate any signals at and above Fs / 2.

这篇关于我如何获得在FFT每个值的频率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆