nthroot
Real n-th root of an array.
Syntax
Section titled “Syntax”Y = nthroot(X, n)Description
Section titled “Description”Returns the real n-th root of each element of X. n must be a positive integer scalar. For odd n, negative inputs return real negative results; for even n, negative inputs raise a complex domain warning (or return NaN depending on element type). Equivalent to X.^(1/n) for positive X.
Examples
Section titled “Examples”nthroot(27, 3) % 3nthroot(-8, 3) % -2 (cube root of -8)nthroot([1 8 27], 3) % [1 2 3]