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

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

问题描述

我有一个 FFT 结果.它们存储在两个 double 数组中:实部数组和虚部数组.如何确定与这些数组中的每个元素对应的频率?

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?

换句话说,我想创建一个数组来存储我的 FFT 的每个实部和虚部的频率.

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

推荐答案

FFT 中的第一个 bin 是 DC (0 Hz),第二个 bin 是 Fs/N,其中 Fs 是采样率,N 是 FFT 的大小.下一个 bin 是 2 * Fs/N.概括地说,nth 个 bin 是 n * Fs/N.

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.

因此,如果您的采样率 Fs 为 44.1 kHz,而您的 FFT 大小 N 为 1024,则 FFT 输出箱位于:

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

请注意,对于实数输入信号(虚部全为零),FFT 的后半部分(从 N/2 + 1N - 1 的区间)包含没有有用的附加信息(它们与前 N/2 - 1 个 bin 具有复共轭对称性).最后一个有用的 bin(用于实际应用)位于 N/2 - 1,对应于上述示例中的 22006.9 Hz.N/2 处的 bin 表示奈奎斯特频率下的能量,即 Fs/2(在本例中为 = 22050 Hz),但这通常没有任何实际用途,因为抗混叠滤波器通常会衰减 Fs/2 及以上的任何信号.

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天全站免登陆