iFFT of symmetric spectrum

孤者浪人 提交于 2019-12-07 17:38:36

问题


I perform the iFFT on a symmetric spectrum (using Python). Why is the result not an real-valued signal but contains complex values?

# My symmetric spectrum
spectrum = numpy.array( [1+1j,2+2j,3+3j,3-3j,2-2j] )

# Perform the iFFT
print numpy.fft.ifft(spectrum)

Output:

(2.2+0.2j)
(-1.98979431354+0.2j)
(0.59464641547+0.2j)
(-0.74743281997+0.2j)
(0.942580718037+0.2j)

回答1:


Try it like this:

# My symmetric spectrum
spectrum = numpy.array( [0+0j,1+1j,2+2j,3+3j,0+0j,3-3j,2-2j,1-1j] )

# Perform the iFFT
print numpy.fft.ifft(spectrum)

Normally bin 0 is DC, bin N/2 is Nyquist, and both of these values are real. For the other terms the symmetry is complex conjugate around Nyquist.

With Octave (MATLAB clone) I get the same result as you for your original input data:

octave-3.4.0:1> x = [1+1j,2+2j,3+3j,3-3j,2-2j];
octave-3.4.0:2> y = ifft(x)
y =

   2.20000 + 0.20000i  -1.98979 + 0.20000i   0.59465 + 0.20000i  -0.74743 + 0.20000i   0.94258 + 0.20000i

whereas with my input data above I get a purely real result:

octave-3.4.0:3> x = [0+0j,1+1j,2+2j,3+3j,0+0j,3-3j,2-2j,1-1j];
octave-3.4.0:4> y = ifft(x)
y =

   1.50000  -1.56066   0.00000   0.14645  -0.50000   0.56066  -1.00000   0.85355

I assume that numpy probably uses the same comnventions for ordering FFT/IFFT input/output data.



来源:https://stackoverflow.com/questions/9062387/ifft-of-symmetric-spectrum

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