How can I determine which roots are closest to the unit circle?

4 ビュー (過去 30 日間)
Murdifi Bin Muhammad
Murdifi Bin Muhammad 2019 年 1 月 11 日
Hi all!
I have a problem that I'm currently facing. Lets say I have a column vector (6x1) in which all elements provides me the roots of a polynomial.
For example,
root_out = 6×1 complex
-2.446362435057714 - 0.000000000000002i
-0.408770174717145 - 0.000000000000000i
0.862312857431274 - 0.529586047198464i
0.842065522070228 - 0.517151225883085i
0.862312857431279 + 0.529586047198471i
0.842065522070224 + 0.517151225883078i
Out of this list (Which may vary in size for its rows), how do I determine which root_out elements (could be more than 1) are closest to the unit circle efficiently? (Maybe in something like a search/range function?)

採用された回答

Jan
Jan 2019 年 1 月 11 日
編集済み: Jan 2019 年 1 月 11 日
x = [ -2.446362435057714 - 0.000000000000002i, ...
-0.408770174717145 - 0.000000000000000i, ...
0.862312857431274 - 0.529586047198464i, ...
0.842065522070228 - 0.517151225883085i, ...
0.862312857431279 + 0.529586047198471i, ...
0.842065522070224 + 0.517151225883078i, ...
0.842065522070228 - 0.517151225883085i]; % Repeated 4th line
r = abs(x);
d = abs(r - 1);
index = (d == min(d));
result = x(index)
Now result contains the value(s), which are nearest to the unit circle. I've repeated the 4th value to test the output of multiple minimal values.
  3 件のコメント
Jan
Jan 2019 年 1 月 13 日
編集済み: Jan 2019 年 1 月 13 日
Find n=3 points with smallest distance to unit circle:
n = 3;
radius = abs(x);
dist = abs(r - 1);
[~, index] = sort(dist);
x(index(1:n))
With Matlab >= R2017b:
n = 3;
radius = abs(x);
dist = abs(r - 1);
[~, index] = mink(dist, n);
x(index)
Murdifi Bin Muhammad
Murdifi Bin Muhammad 2019 年 1 月 13 日
Thanks Jan! This worked well! You're a lifesaver!
Murdifi

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

その他の回答 (1 件)

Torsten
Torsten 2019 年 1 月 11 日
[~,ix] = min(abs(real(root_out).^2+imag(real_out).^2-1)./sqrt(real(root_out).^2+imag(real_out).^2));
root_out(ix)

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by