how matlab calculate the sqrt of complex number?

6 ビュー (過去 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 Center および File ExchangeStartup and Shutdown についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by