在Matlab和Java中的ftf [英] fft in matlab and java

查看:110
本文介绍了在Matlab和Java中的ftf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用jtransforms库在matlab和java中进行了fft,但结果略有不同.

I did fft in matlab and in java using jtransforms library but the results are slightly different.

Matlab results:
-0.0530528652679544
-0.00775535711930750 + 0.0281791646147104i
-0.0304104457750988 - 0.209776156064443i
0.266945753193636 + 0.200338044445226i

Jtransforms results:
-0.05305448436232618
-0.007755593801247046 + 0.028180024600812384
-0.03041137385657606 -0.20978255812004887
0.26695389998013486 + 0.20034415846373468

结果不同还是Matlab只是舍入了值?

Are the results different or Matlab is just rounding the values?

推荐答案

几种不同的算法进行FFT.原则上,它们都是平等的,但实际上,结合浮点运算,结果将略有不同.即使基本FFT算法相同,实现细节(例如求和顺序)也可能导致差异.许多现代处理器都会执行此操作,即使您没有做任何特殊的操作,具体取决于优化标志.

There are several different algorithms for doing FFT. In principle they're all equal, but in practice, combined with floating-point arithmetic, the results will be slightly different. Even if the basic FFT algorithm is the same, implementation details such as order of summation can cause differences. Many modern processors do this even if you don't do anything special, depending on the optimization flags.

在您的结果中,差异大约为第5个有效数字.这是一个相当小的差异.您可以尝试对结果进行逆变换(同时使用Matlab和JTransforms IFT),以查看一个或另一个变换是否明显更准确.

In your results, the differences are at about 5th significant digit. It's a reasonably small difference. You could try inverse transforming the results (using both Matlab and JTransforms IFTs) to see whether one or the other of the transforms is clearly more accurate.

这篇关于在Matlab和Java中的ftf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆