How to plot graphs for a loop for all the different values you've selected for the loop
Mostrar comentarios más antiguos
I've used a for loop to change the temperature where an event code happens to change a value in a dT/dt derivative. Does anyone know how to code so that all the graphs for the 6 different derivatives against time can be plotted? I need all the graphs because I need to observe when the reactor blows up and at what temperature I selected. Any help would be greatly appreciated.
Respuestas (1)
Image Analyst
el 18 de En. de 2022
Do you want all the plots in one graph? If so use hold on:
for k = 1 : 6
% Get x and y, then call plot
plot(x, y, '-');
hold on;
end
legend;
Or do you want 6 different plots? If so use subplot():
for k = 1 : 6
% Get x and y, then call plot
subplot(2, 3, k);
plot(x, y, '-');
end
legend;
5 comentarios
Tom Goodland
el 18 de En. de 2022
Image Analyst
el 18 de En. de 2022
You didn't answer either of my two questions. Why not?
To plot them all on one plot, I think you can use
plot(t, y, '-', 'LineWidth', 3);
Tom Goodland
el 18 de En. de 2022
Tom Goodland
el 18 de En. de 2022
Image Analyst
el 18 de En. de 2022
Exactly which variable is the temperature at each iteration?
Categorías
Más información sobre Loops and Conditional Statements 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!