From fb9588a9a30324077730262bee219f623a06f6ab Mon Sep 17 00:00:00 2001 From: Lars Hubatsch <hubatsch@pks.mpg.de> Date: Tue, 10 Aug 2021 11:53:41 +0200 Subject: [PATCH] plot_sim can now work with two species. --- @Ternary_model/plot_sim.m | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/@Ternary_model/plot_sim.m b/@Ternary_model/plot_sim.m index faa2bb9..88e8109 100644 --- a/@Ternary_model/plot_sim.m +++ b/@Ternary_model/plot_sim.m @@ -18,26 +18,37 @@ if strcmp(mode, 'mov') axis([0, T.system_size, 0, max(T.sol(:))]); ax = gca; ax.FontSize = 12; xlabel('position'); ylabel('probability [not normalized]'); - plot(T.x, T.phi_tot(T.x, T.a, T.b, T.e, T.u0, T.t(i)*T.v), 'LineWidth', 2, ... - 'LineStyle', '--'); - plot(T.x, T.sol(i, :), 'LineWidth', 2); + plot(T.x, T.phi_tot(T.x, T.a, T.b, T.e, T.u0, T.t(i)*T.v),... + 'LineWidth', 2, 'LineStyle', '--'); + if length(size(T.sol))==2 + plot(T.x, T.sol(i, :), 'LineWidth', 2); + elseif length(size(T.sol))==3 + plot(T.x, T.sol(i, :, 1), 'LineWidth', 2, 'Color', color); + plot(T.x, T.sol(i, :, 2), 'LineWidth', 2, 'Color', 'k'); + end text(abs(-T.a+2), 0.7, num2str(T.t(i))); shg; pause(); % print([num2str(i),'.png'],'-dpng') end elseif strcmp(mode, 'plot') - figure(20); -% cla; - hold on; + figure(20); hold on; xlim([-inf, -2*T.a]); %ylim([-inf, max(T.sol(:))]); ax = gca; ax.FontSize = 12; xlabel('x [\mum]'); ylabel('volume fraction'); % N = max(max(T.sol([1, 2:nth:si(1)], :))); N = 1; - plot(T.x*x_scale, T.sol([1, start:nth:si(1)], :)/N, 'LineWidth', 1, 'Color', color); plot(T.x*x_scale, Ternary_model.phi_tot(T.x, T.a, T.b, T.e, T.u0, 0),... 'LineWidth', 1, 'LineStyle', '--', 'Color', [0.97, 0.55, 0.03]); + if length(size(T.sol))==2 + plot(T.x*x_scale, T.sol([1, start:nth:si(1)], :)/N, 'LineWidth', 1,... + 'Color', color); + elseif length(size(T.sol))==3 + plot(T.x*x_scale, T.sol([1, start:nth:si(1)], :, 1)/N, 'LineWidth', 1,... + 'Color', color); + plot(T.x*x_scale, T.sol([1, start:nth:si(1)], :, 2)/N, 'LineWidth', 1,... + 'Color', 'k'); + end end end -- GitLab