How can I determine which roots are closest to the unit circle?
4 次查看(过去 30 天)
显示 更早的评论
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?)
0 个评论
采纳的回答
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.
更多回答(1 个)
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)
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!