How can I tell MATLAB to discard two roots and only proceed with one value?

I used the matlab function "roots" to find the roots of a cubic. This is within a for loop, so the values are always changing based on my inputs, but the three roots are generally along the lines of:
T2 =
1.0e+04 *
2.658308259664422
-0.442009626219650
0.057471418250745
How can I tell matlab to take the 0.057471418250745 value and discard the other two values going forward? I'm trying to simulate the brayton cycle if that helps.
Thanks! Tom

 Respuesta aceptada

Does reassigning help?
T = T2(3);
or removing the first two?
T2(1:2) = [];
I am not familiar with brayton cycle, but if you have a specific criterion for rejection or you mean something else by "discard the other two values going forward" Please share some code or more details about your use case.

Más respuestas (1)

Categorías

Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by