如何计算使用FFT数据的频率是多少? [英] How to compute frequency of data using FFT?
问题描述
我想知道数据的频率。我有一点点想法,它可以使用FFT来完成,但我不知道该怎么做。有一次,我通过了整个数据的FFT,那么它给我2个高峰,但我怎么能得到的频率?
I want to know the frequency of data. I had a little bit idea that it can be done using FFT, but I am not sure how to do it. Once I passed the entire data to FFT, then it is giving me 2 peaks, but how can I get the frequency?
感谢很多提前。
推荐答案
假设 X [N] = COS(2 * PI * F0 * N / FS)
,其中 F0 code>的单位是赫兹,
N =您的正弦波的频率0:N-1
和 FS
是每秒采样的采样率X
。
Suppose x[n] = cos(2*pi*f0*n/fs)
where f0
is the frequency of your sinusoid in Hertz, n=0:N-1
, and fs
is the sampling rate of x
in samples per second.
让 X = FFT(X)
。无论 X
和 X
有长度 N
。假设 X
有两个峰 N0
和的N- N0
。
Let X = fft(x)
. Both x
and X
have length N
. Suppose X
has two peaks at n0
and N-n0
.
然后在正弦波频率是 F0 = FS * N0 / N
赫兹。
示例的 FS
=每秒8000个样本, N
= 16000采样。因此, X
持续两秒钟。
Example: fs
= 8000 samples per second, N
= 16000 samples. Therefore, x
lasts two seconds long.
假设 X = FFT(X)
已在2000和14000(= 16000-2000)的峰值。因此, F0 code> = 8000 *一万六千分之二千= 1000赫兹。
Suppose X = fft(x)
has peaks at 2000 and 14000 (=16000-2000). Therefore, f0
= 8000*2000/16000 = 1000 Hz.
这篇关于如何计算使用FFT数据的频率是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!