We have moved to @ Placement Papers Hub !! Visit our new website here for more..

Matlab Square root Real nth root

1.Square root

B = sqrt(X) returns the square root of each element of the array X. For the elements of X that are negative or complex, sqrt(X) produces complex results.
  
>> X=4;
>> B=sqrt(X)

B =

     2

>> Y=4+9i

Y =

   4.0000 + 9.0000i

>> C=sqrt(Y)

C =

   2.6314 + 1.7101i

>> Z=-4;

>> D=sqrt(Z)

D =

        0 + 2.0000i


2.Real nth root

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.


>> Y=nthroot(8,3)

Y =

     2

>> Y=nthroot(64,3)

Y =

     4

>> Y=nthroot(-8,3)

Y =

    -2

>> Y=nthroot(-64,3)

Y =

    -4