如何在MATLAB中获得(-8)^ 0.333333 = -2? [英] How to get (-8)^0.333333 = -2 in MATLAB?

查看:150
本文介绍了如何在MATLAB中获得(-8)^ 0.333333 = -2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用MATLAB指数函数:

 ( -  8)^ 0.333333 
ans = 1.0000 + 1.7320i

如何获得( - 8)^ 0.333333 = -2 改为?

  x = -10:-1; 
x。^ 0.333333

如何获得真实价值? b

如何重新定义 ^

  x。^ y 



<$ p $ (x)。* abs(x。^ y))


解决方案

MATLAB 7.0提供了 NTHROOT 函数,它返回一个数字的真正根。所以你的公式变成 NTHROOT(-8,3)= -2



如果你使用的是MATLAB 7.0(R14),请阅读以下内容:

获取负实数x的实数立方根,而不是执行:

  x。^(1/3)

使用以下命令:

  sign(x)。* abs(x。^(1/3) )

这将找到根的绝对值并通过参数的符号对其进行修改。 / p>

看到这个


Using MATLAB exponential function:

(-8)^0.333333
ans = 1.0000 + 1.7320i

How to get (-8)^0.333333 = -2 instead?

x=-10:-1;
x.^0.333333

How to get real value?

How to redefine ^:

x.^y

to

sign(x).*abs(x.^y))

解决方案

MATLAB 7.0 provides the NTHROOT function, which returns the real roots of a number. So your formula becomes NTHROOT(-8, 3) = -2

If you are using a version prior to MATLAB 7.0 (R14), please read the following:

To obtain the real cube root of a negative real number "x", rather than executing:

x.^(1/3)

use the command:

sign(x).*abs(x.^(1/3))

This will find the absolute value of the root and modify it by the sign of the argument.

See this

这篇关于如何在MATLAB中获得(-8)^ 0.333333 = -2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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