How to create a matrix for plotting from a roots matrix in a loop?
显示 更早的评论
Hello,
So my problem is that currently I have a script that solves a polynomial of 4th order and gives me all the roots for it. However since it is for an engineering application I only need the logical value given by one of the roots.
My code goes something like this
while (condition)
code;
r = roots(x);
end
and this runs as long as the condition is true.
Because the user ends up producing many values of r, I was wondering how I can take for example the 4th position of r or r(4) and make a matrix of all the values of r(4) produced by the loop so that I can plot them.
If it helps the problem asks the user to input a ratio of Oxygen to MEthane and r(4) is the temperature of the reaction.
I need to plot this temperature vs the ratio.
Also I looked at things like
for i = 1:10
y(i) = 1 + rand
end
but can't seem to get that working with what I want.
Thank You in advance and feel free to ask for clarifications if any.
采纳的回答
更多回答(1 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!