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

조회 수: 19 (최근 30일)
Ron_S
Ron_S 2022년 4월 5일
댓글: Star Strider 2022년 4월 7일
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
Ron_S
Ron_S 2022년 4월 7일
Hopefully it will be accepted! I'll keep you posted.
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