フィルターのクリア

How to compute sqrt of complex number ?

31 ビュー (過去 30 日間)
Dimitar
Dimitar 2012 年 10 月 13 日
sqrt(z) , (where z=x+iy a general complex number) will have two solutions. I would like to pick up a solution that lies in the fourth quadrant always. How can i do it ?
sqrt(z)=sqrt(r)e^(1/2*i*(phase+2*k*pi)) ,where k= 0,1, r=(x^2+y^2)^(1/2) The solution has two branches I would like to pick a specific one.
min = 0.65;
max = 0.95;
no = complex(1,-10^-4);
c = linspace(min, max, 10000);
n1 = (1+0.6961663.*c.^2./(c.^2-0.0684043.^2) + 0.4079426.*c.^2./(c.^2-0.1162414.^2) + 0.8974794.*c.^2./(c.^2-9.896161.^2)).^(1/2);
n1 = complex(n1,-10^-5);
b = length(c);
theta = 45*(3.14/2)/180;
for i = 1:b
sqd1(i) = sqrt(n1(i)^2 - no^2*sin(theta)^2);
% need to pick up the solution in the fourth quadrant
end
  3 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 10 月 13 日
sqrt(x+i*y) is a function : one result
Dimitar
Dimitar 2012 年 10 月 14 日
編集済み: Matt Fig 2012 年 10 月 14 日
I mean z=x+i*y (i=sqrt(-1)) is complex number
sqrt(z) = sqrt(r)e^(1/2*i*(phase+2*k*pi))
% With k= 0,1, r=(x^2+y^2)^(1/2)
The solution has two branches I would like to pick a specific one.

サインインしてコメントする。

採用された回答

Rick Rosson
Rick Rosson 2012 年 10 月 14 日
編集済み: Rick Rosson 2012 年 10 月 14 日
First method:
r = roots([1 0 z]);
phi = angle(r);
v = r(phi<0);
Second method:
r = roots([1 0 z]);
p = imag(r);
v = r(p<0);
The second method is probably faster.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Decomposition についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by