Filter löschen
Filter löschen

Problem with the sqrt function

3 Ansichten (letzte 30 Tage)
Chirag Anand
Chirag Anand am 8 Jun. 2017
Kommentiert: Stephen23 am 8 Jun. 2017
when I use the sqrt function to find the sqrt of a determinant of a complex matrix, sometimes matlab changes the sign of the real and imaginary part of the square root. for example if the it is -x+iy the sqrt function gives the answer as x-iy How do I get around this?
  2 Kommentare
Adam
Adam am 8 Jun. 2017
Bearbeitet: Adam am 8 Jun. 2017
Just like in the real case, if a is a square root then so is -a. In the real case the positive square root is always returned, for complex numbers the documentation states that sqrt(z) returns:
sqrt(r)*(cos(phi/2) + 1i*sin(phi/2))
where r = abs(z) is the radius and phi = angle(z) is the phase angle on the closed interval -pi <= phi <= pi.
Stephen23
Stephen23 am 8 Jun. 2017
"Problem with the sqrt function"
What is the problem? sqrt is giving a correct output.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by