Problem with the sqrt function

조회 수: 1 (최근 30일)
Chirag Anand
Chirag Anand 2017년 6월 8일
댓글: Stephen23 2017년 6월 8일
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
Adam
Adam 2017년 6월 8일
편집: Adam 2017년 6월 8일
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 2017년 6월 8일
"Problem with the sqrt function"
What is the problem? sqrt is giving a correct output.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by