how matlab calculate the sqrt of complex number?
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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.
0 comentarios
Respuestas (1)
Babak
el 20 de Mzo. de 2013
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)
0 comentarios
Ver también
Categorías
Más información sobre Get Started with MATLAB en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!