How can I determine which roots are closest to the unit circle?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Murdifi Bin Muhammad
el 11 de En. de 2019
Comentada: Murdifi Bin Muhammad
el 13 de En. de 2019
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 comentarios
Respuesta aceptada
Jan
el 11 de En. de 2019
Editada: Jan
el 11 de En. de 2019
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 comentarios
Más respuestas (1)
Torsten
el 11 de En. de 2019
[~,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 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!