如何从Matlab中的复杂FFT中获取正弦/余弦函数的系数?

发布于 2024-12-12 13:31:01 字数 234 浏览 2 评论 0原文

我正在开发一个测量振动机器人手臂运动的控制系统。因为存在一些死区时间,所以我需要研究有些噪声信号的未来。 我的想法是使用采样信号中的频率并产生可用于外推的傅立叶函数。

我的问题:我已经有了信号向量的 FFT(例如包含 60-100 个值),并且可以看到幅度谱中的主要频率。现在我想要一个函数 f(t) 适合信号,消除一些噪声,并可用于预测信号的不久的将来。如何从复杂的 FFT 数据中计算正弦/余弦函数的系数?

太感谢了!

I'm working on a control system that measures the movement of a vibrating robot arm. Because there is some deadtime, I need to look into the future of the somewhat noisy signal.
My idea was to use the frequencies in the sampled signal and produce a fourier function that could be used for extrapolation.

My question: I already have the FFT of the signal vector (containing 60-100 values e.g.) and can see the main frequencies in the amplitude spectrum. Now I want to have a function f(t) which fits to the signal, removes some noise, and can be used to predict the near future of the signal. How do I calculate the coefficients for the sine/cosine functions out of the complex FFT data?

Thank you so much!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

苏大泽ㄣ 2024-12-19 13:31:01

AFAIR FFT 本质上产生的输出是不同频率的正弦函数之和。每个频率的重要性是每个峰值的高度。因此,您真正想做的是过滤掉一些频率(即手臂轻轻移动的高频),然后回到时域。

在 matlab 中,这应该就像遍历从 fft 获得的向量,将一些值设置为 0(或对其进行更复杂的操作),然后使用 ifft 返回时域并根据您得到的结果进行预测。

执行此操作时还应该考虑一件事 - 奈奎斯特频率 - 这意味着您在 fft 上获得的最高频率是采样频率的一半。

AFAIR FFT essentially produces output as a sum of sine functions with different frequencies. The importance of each frequency is the height of each peak. So what you really want to do here is filter out some frequencies (ie. high frequencies for the arm to move gently) and then come back to the time domain.

In matlab this should be like going through the vector of what you got from fft, setting some values to 0 (or doing something more complex to it) and then use ifft to come back to time domain and make the prediction based on what you get.

There's also one thing you should consider while doing this - Nyquist frequency - this means that the highest frequency that you get on your fft is half of the sampling frequency.

无远思近则忧 2024-12-19 13:31:01

如果您对 FFT 孔径长度内的非周期性数据使用 FFT,则可能需要使用窗口来减少由于“频谱泄漏”而产生的杂散频率。更好地估计“频点之间”频率内容的频率估计技术也可能是合适的。每个余弦正弦曲线相对于窗口边缘的相位通常为atan2(imag[i], real[i])。频率取决于采样率和 bin 数量与 FFT 长度的关系。

您可能还想考虑使用卡尔曼滤波器而不是 FFT。

添加:如果您的信号在 FFT 长度中不完全是整数周期,那么您可能需要在 FFT 之前进行 fftshift,以将生成的相位测量参考点移动到数据矢量的中心,而不是可能不连续的圆形边缘。

If you use an FFT for data that isn't periodic within the FFT aperture length, then you may need to use a window to reduce spurious frequencies due to "spectral leakage". Frequency estimation techniques to better estimate "between bin" frequency content may also be appropriate. The phase of each cosine sinusoid, relative to the edge of the window, is usually atan2(imag[i], real[i]). The frequency depends on the sample rate and bin number versus the length of the FFT.

You might also want to look into using a Kalman filter instead of an FFT.

Added: If your signal isn't exactly integer periodic in the FFT length, then you may want to do an fftshift before the FFT to move the resulting phase measurement reference point to the center of your data vector, instead of a possibly discontinuous circular edge.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文