How to plot more than one graph on a single tile using tiledlayout?

19 次查看(过去 30 天)
I'm solving 17 species through ode45 (using a for loop with three different initial values). I want to plot all three solutions of a single species on one tile using tiledlayout. With the code I currently have it only plots the third iteration of each species. Could you please provide your expert advise? Thank you!
% Numerically finding the all-positive equilibrium point
% Remove the contents of the workspace
clear
% Set the initial time domain for integration
tstart=0;tend=150;
tspan=[tstart,tend];
y0 = [1:10:21 1:10:21 1:10:21 1:10:21 1:10:21 1:10:21 1:10:21 1:10:21 1:10:21 1:10:21 1:10:21 1:10:21 1:10:21 1:10:21 1:10:21 1:10:21 1:10:21 1:10:21];
for k = 1:length(y0)
[t,y] = ode45(@Chol_model3,tspan,[y0(k) y0(k) y0(k) y0(k) y0(k) y0(k) y0(k) y0(k) y0(k) y0(k) y0(k) y0(k) y0(k) y0(k) y0(k) y0(k) y0(k) y0(k)]);
end
tiledlayout(2,2)
nexttile
plot(t,y(:,3),'g','LineWidth', 1,'LineStyle','-');
title('B')
xlabel('Time')
ylabel('Species concentration')
nexttile
plot(t,y(:,4),'k','LineWidth', 1,'LineStyle','-');
nexttile
plot(t,y(:,5),'r','LineWidth', 1,'LineStyle','-');
nexttile
plot(t,y(:,6),'b','LineWidth', 1,'LineStyle','-');

采纳的回答

Star Strider
Star Strider 2022-4-5
I cannot run the posted code, however it is definitely possible to plot more than one series on a specific tile using the hold function —
t = 0:10;
tiledlayout(1,2)
nexttile
plot(t, rand(1,11))
hold on
plot(t, randn(1,11))
hold off
nexttile
plot(t, rand(1,11))
hold on
plot(t, randn(1,11))
hold off
.
  13 个评论
Star Strider
Star Strider 2022-4-7
Thank you!
If you also send it to me as an email through my profile page, please provide a context so I’ll know what it refers to, in addition to including a link to this thread. If it’s just a link, I’ll probably not recognise it, and I’m averse to clicking on uinknown links.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Performance 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by