c++ - Kiss FFT 似乎将数据乘以它转换的点数

标签 c++ signal-processing fft kissfft

我对傅立叶变换的有限理解是,您应该能够在不更改原始数据的情况下在时域和频域之间切换。所以,这里是我(认为我)正在做的事情的总结:

  1. 使用 kiss_fft_next_fast_size(994) 确定我应该使用 1000。

  2. 使用 kiss_fft_alloc(...) 创建一个kiss_fft_cfgnfft = 1000

  3. 通过将额外的点填充为零,将我的输入数据从 994 扩展到 1000。

  4. kiss_fft_cfg 连同我的输入和输出数组传递给 kiss_fft(...)

  5. 使用 kiss_fft_alloc(...) 创建一个 inverse kiss_fft_cfg nfft = 1000

  6. 逆 kiss_fft_cfg 传递给 kiss_fft(...) 输入前一个输出数组。

  7. 期望返回原始数据,但得到的每个数据正好大 1000 倍!

我放了一个full example here ,我的 50 多行代码可以在最后找到。虽然我可以通过将每个结果除以 OPTIMAL_SIZE 的值(即 1000)来解决这个问题,但这个修复让我非常不安,却不明白为什么。

请问我做错了什么愚蠢的事情吗?

最佳答案

这是意料之中的:逆离散傅里叶变换(可以使用快速傅里叶变换实现)需要除以 1/N:

The normalization factor multiplying the DFT and IDFT (here 1 and 1/N) and the signs of the exponents are merely conventions, and differ in some treatments. The only requirements of these conventions are that the DFT and IDFT have opposite-sign exponents and that the product of their normalization factors be 1/N. A normalization of \sqrt{1/N} for both the DFT and IDFT makes the transforms unitary, which has some theoretical advantages. But it is often more practical in numerical computation to perform the scaling all at once as above (and a unit scaling can be convenient in other ways).

http://en.wikipedia.org/wiki/Dft

关于c++ - Kiss FFT 似乎将数据乘以它转换的点数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12036374/

相关文章:

audio - 以编程方式增加音频样本阵列的音高

matlab - Matlab 中信号的扭曲片段

audio - 除了FFT以外,还有没有其他方法可以实现Guitar Tuner?

matlab - 使用图片的清晰部分重新创建 PSF

ios - 如何使用vDSP_conv来模拟MATLAB的xcorr函数?

c++ - 如何确保远程对等方在调用 asio 套接字 close() 函数之前接收到所有数据

c++ - 在 opencv 中为图像训练 svm

python - Scipy:Hermite 函数与正交权重的集成

c++ - 添加命名空间会删除对类私有(private)成员的好友访问权限

c++ - protocol buffers + zlib = 未解析的外部符号