正弦波频率拟合 [英] Sine wave frequency fitting

查看:134
本文介绍了正弦波频率拟合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题基于先前的类似问题.

我有以下方程式和已调整的(一些随机数据):0.44 * sin(N * 2 * PI/30)

I have the following equation and an adjusted (some random data): 0.44*sin(N* 2*PI/30)

我正在尝试使用FFT从生成的数据中获取频率.但是频率最终接近但不等于频率(这会使波比预期的大一点)

I am trying to use the FFT to get the frequency from the data generated. However the frequency ends up being close but not equal to the frequency (which makes the wave a bit larger than intended)

FFT的最大频率为7hz,但是预期的频率为(30/2PI)4.77hz.

The frequencies that are at the maximum for the FFT is 7hz, however the expected frequency is (30/2PI) 4.77hz.

我提供了FFT图表和标绘值.

I've included a graph of the FFT and plotted values.

我正在使用的代码是:

[sampleFFTValues sFreq] = positiveFFT(sampledata, 1);
sampleFFTValues = abs(sampleFFTValues);
[v sFFTV]= max(sampleFFTValues)

可以在此处找到.基本上,它使FFT图居中并切除负信号.

Positive FFT can be found here. Basically it centers the FFT graph and cuts off the negative signals.

我的问题是,如何才能使FFT更加精确,而不必仅针对频率求最小二乘?

My question is how can I get the FFT to be more accurate without having to resort to least squares for just the frequency?

推荐答案

我认为FFT不能很好地用于(准)周期性信号的精细分辨率频率测量-见下文.

I don't think FFT is good for a fine-resolution frequency measurement for (quasi)periodic signals - see below.

每个离散FFT都在非整数bin频率(即与特定FFT的频率阶跃之一不完全对应的任何频率)上扩展;这些中间"频率将在最接近的整数档周围涂抹/散布.这种扩展的形状(扩展功能")取决于用于FFT的开窗功能.为了简化和概括事物,此扩展功能要么非常狭窄但非常参差不齐(非常高的峰/非常低的山谷),或者更宽泛但不那么参差不齐.从理论上讲,您可以对正弦波进行非常精细的频率扫描,并为每个正弦波计算FFT,然后可以通过保存所有FFT的输出以及产生该输出的频率来校准"函数的形状和行为,然后通过将要测量的信号的FFT输出与先前保存的结果进行比较,找到最近"的频率,可以找到更精确的频率.

Every discrete FFT has spreading on non-integer bin frequencies (that is on any frequency which does not exactly correspond to one of the frequency steps of the particular FFT); these "intermediate" frequencies will be smeared/spread out around the nearest integer bin. The shape of this spreading ("spreading function") depends on the windowing function used for the FFT. This spreading function - to simplify and generalize things - is either very narrow but very-very ragged (very high peaks/very low valleys), or wider but less ragged. In theory, you could do a very fine frequency sweep of sine waves and calculate FFT for each of them, and then you could "calibrate" the function's shape and behaviour by saving outputs of all FFTs together with the frequency that resulted in that output, and then by comparing the FFT output of the signal to be measured to the previously saved results and finding the "closest" one find a more exact frequency.

很多努力.

但是如果只需要测量单个信号的频率,则不要这样做.

But don't do this if you only need to measure frequency of a single signal.

请尝试测量波长.这可以很简单,例如测量零交叉点之间的距离(可能需要多个周期才能获得更高的精度-哎呀,如果有那么多的话就测量1000个周期),然后将采样率除以该频率即可得出频率.更简单,更快,更精确.

Instead try to measure wavelength. This can be as simple as measuring the distance between zero crosses (perhaps for multiple cycles to get more precision - heck, measure 1000 cycles if you have that many) in samples, and divide the sample rate by that to arrive at the frequency. Much simpler, faster and much more precise.

例如:48000 Hz的采样率,4.77 Hz的信号仅通过使用最粗略的方法测量一个周期的长度即可获得〜0.0005 Hz的分辨率. (如果您使用 n 个周期,则频率分辨率也将乘以 n .)

Example: 48000 Hz sample rate, 4.77 Hz signal results in ~0.0005 Hz resolution just by measuring the length of one cycle with the crudest approach. (If you take n cycles, the frequency resolution multiplies by n as well.)

这篇关于正弦波频率拟合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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