Skip to Main Content Skip to Search
Product Documentation

nthroot - Real nth root of real numbers

Syntax

y = nthroot(X, n)

Description

y = nthroot(X, n) returns the real nth root of the elements of X. Both X and n must be real and n must be a scalar. If X has negative entries, n must be an odd integer.

Examples

nthroot(-2, 3)

returns the real cube root of -2.

ans =

   -1.2599

By comparison,

(-2)^(1/3)

returns a complex cube root of -2.

ans =

   0.6300 + 1.0911i

See Also

power | sqrt

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS