Looping over Only the Real Positive Roots
Mostrar comentarios más antiguos
In my model, I am searching for a value of one variable, let's call it a, over an interval. To find the best value of this variable, I need to find the five roots of another variable, let's call it b, and search over each of the positive real roots.
When only one of the roots is real, the process is simple. My issue is that I don't know how to only select the positive roots of b and loop through each of those only.
Anyone have any suggestions?
Thanks.
Respuestas (2)
Walter Roberson
el 26 de Mayo de 2012
RB = roots(b);
PRR = RB( imag(RB) == 0 & real(RB) > 0 );
Andrew
el 27 de Mayo de 2012
0 votos
1 comentario
Walter Roberson
el 27 de Mayo de 2012
isempty(PRR)
Categorías
Más información sobre MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!