How to plot graphs for a loop for all the different values you've selected for the loop

조회 수: 43 (최근 30일)
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.

답변 (1개)

Image Analyst
Image Analyst 2022년 1월 18일
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
Tom Goodland
Tom Goodland 2022년 1월 18일
If this is awkward to do because of the sheer volume of graphs that need to load, could you please help me put a condition in where when the reactor temperature reaches 500K or 45 atm stop the loop and let me know what temperature the cooling water change occurs at for the one before the temp that makes the reactor blow up (reach 500 K or 45 atm).
Image Analyst
Image Analyst 2022년 1월 18일
Exactly which variable is the temperature at each iteration?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by