FFTW: Inverse of forward fft not equal to original function

南笙酒味 提交于 2019-12-03 20:39:58

At the risk of dabbling in necromancy, you should note in the fftw docs (here) that it expressly states that fftw does not normalize, thus the result of the inverse transform of a previously transformed signal will be the original signal scaled by 'n' or the length of the signal.

Could be the problem.

The FFTs (forward and inverse) have rounding error, and I think this is what's biting you. In general, you shouldn't expect a zero to stay exactly zero through your process (although it could be zero for trivial test cases). In your test loop, is

fabs(dummy_sq[i][0] - numFreq*numFreq*numFreq*sparseProfile02[0][i][0])

large relative to the magnitude of your data?

As a really simple (pathological) example with just a 1D FFT of size 2 with real values:

ifft(fft([1e20, 1.0])) != [2e20, 2.0]

The 1.0 is lost in the 1e20 with a double precision FFT.

It's also possible you're getting some NaNs for factor when you divide by a zero sample in sparseProfile02.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!