function Figure4_5b

% Matlab code for Figure 4.5(b) in book:
% Radek Erban and Jon Chapman, Stochastic Modelling of Reaction-Diffusion
% Processes, Cambridge University Press, 2019

close all;

D=0.0001;         % 10^{-4} mm^2 sec^{-1}

x=[0:0.001:1];
t=60;
c1=10*erf(x/(2*sqrt(D*t)));
t=120;
c2=10*erf(x/(2*sqrt(D*t)));
t=240;
c3=10*erf(x/(2*sqrt(D*t)));
t=480;
c4=10*erf(x/(2*sqrt(D*t)));
t=960;
c5=10*erf(x/(2*sqrt(D*t)));
t=1920;
c6=10*erf(x/(2*sqrt(D*t)));

figure(1);
set(gca,'Fontsize',18);
plot(x,c1,'k','Linewidth',2);
hold on;
plot(x,c2,'g','Linewidth',2);
plot(x,c3,'m','Linewidth',2);
plot(x,c4,'c','Linewidth',2);
plot(x,c5,'r','Linewidth',2);
plot(x,c6,'b','Linewidth',2);
plot([0 1],[10 10],'k--');
xlabel('$x$  [mm]','interpreter','latex');
ylabel('$p(x,t)$','interpreter','latex');
hh=legend(' $t = 1$ min',' $t = 2$ min',' $t = 4$ min',' $t = 8$ min',' $t = 16$ min',' $t = 32$ min');
set(hh,'interpreter','latex','location','southeast');
axis([0 1 0 11.5]);
set(gca,'Fontsize',18);

