How to plot more than one graph on a single tile using tiledlayout?
5 次查看(过去 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','-');
0 个评论
采纳的回答
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
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 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!