Matlab R2014b中平方根函数和幂的错误 [英] Error with square root function and powers in Matlab R2014b

查看:109
本文介绍了Matlab R2014b中平方根函数和幂的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用sqrt()函数执行一系列计算.我和我的同事已经注意到,使用相同的输入时,我们得到的结果会有所不同.有人遇到过这个问题吗?

I am carrying out a series of calculations using the sqrt() function. My colleagues and I have noticed that we get different results when using the same inputs. Has anyone encountered this problem before?

这是一个示例:

input1 = 4;
input2 = 8;

result = sqrt(input1^2 + input2^2)

然后,结果显示的值与同事的结果不同.我们已经就此问题联系了MathWorks,但尚未收到回复.

Result then displays a different value from my colleagues result. We have contacted MathWorks about this issue and have yet to receive a reply.

推荐答案

我和我的团队在一两年前遇到了相同的问题.

My team and I came across the same problem a year or two ago.

MathWorks解释说,在添加sqrt()函数时,它们的功能存在问题.要克服此问题并获得相同的结果,请在sqrt()函数之外对每个术语取平方:

MathWorks explained that the sqrt() function has an issue with powers when they are added. To overcome this issue and achieve the same result, square each term outside of the sqrt() function:

input1 = 4^2;
input2 = 8^2;

result = sqrt(input1 + input2)

这为我和我的团队解决了这一问题.MathWorks并未阐明问题的原因,但告诉我们他们正在更新其文档(到目前为止尚未看到任何内容).

This solved it for my team and I. MathWorks didn't clarify as to the reason for the issue, but told us they were in the process of updating their documentation (haven't seen anything as of yet).

这篇关于Matlab R2014b中平方根函数和幂的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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