MATLAB 7.0 provides an NTHROOT function that returns the actual roots of a number. This way your formula becomes NTHROOT(-8, 3) = -2
If you are using a version prior to MATLAB 7.0 (R14), read the following:
To get the real cube root of a negative real number "x", rather than execute:
x.^(1/3)
use the command:
sign(x).*abs(x.^(1/3))
This will find the absolute value of the root and change it by the sign of the argument.
Watch it
source share