在matlab和numpy中ifft给出不同的结果

Chr*_*ris 0 python matlab fft ifft

我有另一个问题.非常类似于我已经问过的另一个(并得到很大的帮助 - 再次感谢).不幸的是,其他线程的解决方案在这里不起作用:(http://stackoverflow.com/questions/8680909/fft-in-matlab-and-numpy-scipy-give-different-results)

现在是关于ifft:

  # i have an array 'aaa' of shape (6,) such as:
  for i in aaa:  print i
  ...

 (1.22474487139+0j)
 (-0.612372435696-1.06066017178j)
 (-0.612372435696+1.06066017178j)
 (1.22474487139+0j)
 (-0.612372435696-1.06066017178j)
 (-0.612372435696+1.06066017178j)

  #when i perform np.ifft the result is:
 np.fft.ifft(aaa)

 array([  1.48029737e-16 +1.48029737e-16j,
    -8.26024733e-17 -1.72464044e-16j,
     1.22474487e+00 -3.94508649e-16j,
     3.70074342e-17 -2.96059473e-16j,
    -2.22044605e-16 +2.46478913e-16j,   4.55950391e-17 +4.68523518e-16j])

  ###################################################################
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % BUT IN MATLAB 
  % the same array...

  aaa =

  1.2247          
 -0.6124 - 1.0607i
 -0.6124 + 1.0607i
  1.2247          
 -0.6124 - 1.0607i
 -0.6124 + 1.0607i

 % ...gives the result:
 ifft(aaa)

 ans =

  -0.0000
        0
   1.2247
        0
        0
        0
Run Code Online (Sandbox Code Playgroud)

我做了像范围(1,6)这样的实数的实验.那么结果是一样的.这可能是一个精确的问题吗?但那么 - 为什么结果差异如此之大?也许有人知道如何解决这个问题?

aga*_*rs3 6

如果你看看你的numpy评估中的价值,它们非常小(小于10 ^ -15).我认为这是一个精确的问题,你的结果并没有乍看之下那么不同.