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

1 view (last 30 days)
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

Accepted Answer

Shashank Prasanna
Shashank Prasanna on 9 Feb 2013
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.

More Answers (1)

Thomason
Thomason on 10 Feb 2013
Thanks Benji, reassigning was all I needed to do

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!