Excel中的FFT——如何获得最真实的频谱
我正在尝试使用 Excel 获取这些数据的 FFT 频谱:gggttt.host.sk/sample.xls
。 @Paul R 在另一个问题上帮助了我很多,以弄清楚 bin 的含义,但仍然有一些问题我想理解。
首先,Excel 即使模数以对数刻度表示,也不会以 dB 为单位显示。如何将这些幅度转换为 dB?
此外,还存在关于窗口函数、别名等的问题。由于我正在处理一个时期的数据,因此似乎没有必要应用窗口函数。另外,因为我只需要基波、二次谐波和三次谐波,而不需要较高箱中的其他峰值,所以似乎也没有必要考虑混叠。然而,令人非常担忧的是非 n^2 的点数 – 1253。我尝试用零填充它们直到 2048,或者仅对前 1024 个点进行 FFT,忽略剩余的 229 个点,最后删除每 6 个点点,然后删除每个第 52 个点,并将最后一个点加倍以获得必要的 1024。最终,用零填充是最糟糕的方法 –成对的高低条在整个频谱中重复出现。截断数据(仅处理前 1024 个点)似乎效果最好。我真的很想知道在信号处理方面有经验的人会推荐什么作为产生最真实频谱的最佳方法。
以下是我对这些数据应用 FFT 的两种不同方法的示例:
gggttt.host.sk/fig_truncated.jpg
gggttt.host.sk/fig_padded.jpg
gggttt.host.sk/fig_every_6th_and_52nd_point_deleted.jpg
I’m trying to obtain the FFT spectrum of these data: gggttt.host.sk/sample.xls
using Excel. @Paul R helped me a lot in another question to figure out the meaning of bins but there are still questions which I’d like to understand.
First, Excel, even when the moduli are represented in log scale, does not show them in dB. What do you do to have these magnitudes converted to dB?
Further, there’s a concern about the window function, aliasing etc. Since I’m crunching data from exactly one period, it seems that applying a window function is not necessary. Also, because I need only the fundamental, second and third harmonic and no other peaks in the higher bins, taking care of aliasing also does not seem necessary. Of great concern, however, is the non-n^2 number of points – 1253. I tried padding them with zeros up to 2048 or doing the FFT on just the first 1024, ignoring the 229 remaining points and, finally, deleting every 6th point and then deleting every 52nd point and doubling the last point to get the necessary 1024. Ultimately, padding with zeros turned out to be the worst approach – couples of high and low bars repeat throughout the whole spectrum. Truncating the data (processing only the first 1024 points) appears to work the best. I would really like to know what someone with experience in signal processing would recommend as the best approach in producing the most realistic spectrum.
Here are examples of two different ways I applied the FFT on these data:
gggttt.host.sk/fig_truncated.jpg
gggttt.host.sk/fig_padded.jpg
gggttt.host.sk/fig_every_6th_and_52nd_point_deleted.jpg
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您只有一个数据周期,则应使用恰好该长度的 FFT(如果没有可用的 fft,则应使用 DFT)。理论上,FFT 的长度不限于 2 的幂。
If you have exactly one period of data, you should use a FFT (or DFT if no fft is available) of exactly that length. In theory, FFTs are not limited to powers of 2 in length.
以下是 Octave(MATLAB 克隆)使用所有 1253 个数据点生成的 PSD 图:
正如您所看到的,存在较大的直流分量,而非直流分量看起来就像典型的本底噪声,没有明显的峰值。我的猜测是,如果您怀疑确实存在隐藏在噪声中的峰值,您将需要收集更多数据 - 然后您可以使用时间平均或整体平均来提取这些数据。
以下只是 PSD 的前十点:
Here is a PSD plot as generated by Octave (MATLAB clone) using all 1253 of your data points:
As you can see, there is a large DC component and the non-DC components just look like a typical noise floor with no obvious peaks. My guess is that you'll need to collect more data if you suspect that there really are peaks buried in the noise - you may then be able to extract these using time averaging or ensemble averaging.
Here are just the first ten points of the PSD: