how matlab calculate the sqrt of complex number?

조회 수: 8 (최근 30일)
max
max 2013년 3월 20일
Hi, I've written an algorithm which calculate the sqrt of complex number.
%%%%%%%
a_re=-3;
a_im=-6;
rho= sqrt(a_re*a_re+a_im*a_im);
teta=atan(a_im/a_re);
k=0;
risre=sqrt(rho)* cos(teta/2+2*pi*k/2)
risim=sqrt(rho)* sin(teta/2+2*pi*k/2)
%%%%%%%
but the result is'n the same of (-3-6i)^(1/2). Why? I would like to have the same results.

답변 (1개)

Babak
Babak 2013년 3월 20일
usually powers of between 0 and 1 of complex numbers have multiple answers! As an example, (-3-6i)^(1/2)
[THETA,RHO] = cart2pol(-3,-6)
results in
THETA =
-2.0344
RHO =
6.7082
Thus
-3-6i = RHO*exp(i*THETA)
and therefore its half root is
(-3-6i)^.5 = RHO^.5*exp(i*THETA/2) = 1.3617 - 2.2032i
and
(-3-6i)^.5 = RHO^.5*exp(i*(THETA+2*pi)/2) = -1.3617 + 2.2032i
This is while MATLAB's sqrt function only gives the first answer, i.e. RHO^.5*exp(i*THETA/2)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by