I have this bidimensional array called a:
[2.1814 + 0.0000i 1.1375 + 0.0000i 0.2506 + 0.0000i 0.2506 + 0.0000i 1.1375 + 0.0000i]
[-2.1719 + 0.2033i -1.1326 + 0.1060i -0.2496 + 0.0234i -0.2496 + 0.0234i -1.1326 + 0.1060i]
[2.0884 + 0.6302i 1.0890 + 0.3286i 0.2400 + 0.0724i 0.2400 + 0.0724i 1.0890 + 0.3286i]
[1.8018 + 1.2295i 0.9396 + 0.6412i 0.2070 + 0.1413i 0.2070 + 0.1413i 0.9396 + 0.6412i]
When I run ifft(a) in matlab it gives me this answer:
[0.9749 + 0.5158i 0.5084 + 0.2690i 0.1120 + 0.0593i 0.1120 + 0.0593i 0.5084 + 0.2690i]
[0.2798 - 1.1510i 0.1459 - 0.6002i 0.0322 - 0.1323i 0.0322 - 0.1323i 0.1459 - 0.6002i]
[1.1599 - 0.2007i 0.6049 - 0.1046i 0.1333 - 0.0231i 0.1333 - 0.0231i 0.6049 - 0.1046i]
[-0.2333 + 0.8359i -0.1217 + 0.4359i -0.0268 + 0.0960i -0.0268 + 0.0960i -0.1217 + 0.4359i]
When I run np.fft.ifft2(a) in python it gives me this answer
[[ 0.44314676+0.23444054j 0.22157338+0.11722027j 0.04431468+0.02344405j 0.04431468+0.02344405j 0.22157338+0.11722027j]
[ 0.12718937-0.52317671j 0.06359468-0.26158836j 0.01271894-0.05231767j 0.01271894-0.05231767j 0.06359468-0.26158836j]
[ 0.52724743-0.09120678j 0.26362372-0.04560339j 0.05272474-0.00912068j 0.05272474-0.00912068j 0.26362372-0.04560339j]
[-0.10604754+0.37994295j -0.05302377+0.18997148j -0.01060475+0.0379943j -0.01060475+0.0379943j -0.05302377+0.18997148j]]
Why is it different? How can I make both python and matlab give me the same answer?
question from:
https://stackoverflow.com/questions/65866773/wrong-ifft-in-numpy 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…