function Figure9_1

% Matlab code for Figures 9.1 in book:
% Radek Erban and Jon Chapman, Stochastic Modelling of Reaction-Diffusion
% Processes, Cambridge University Press, 2019

close all;

load data_Figure9_1_b.dat;
trm1=data_Figure9_1_b;

figure(1);
set(gca,'Fontsize',18);
bar(trm1(:,1),trm1(:,2),'Facecolor',[0.88 0.88 0.88],'Linewidth',2);
hold on;
plot([-1 1],[5 5],'k--','Linewidth',4);
set(gca,'Xtick',[-1 -0.5 0 0.5 1]);
set(gca,'Ytick',[0 1 2 3 4 5 6 7]);
xlabel('position $x$','interpreter','latex');
ylabel('density of molecules','interpreter','latex');
axis([-1 1 0 7.5]);
set(gca,'Fontsize',18);

load data_Figure9_1_c.dat;
trm2=data_Figure9_1_c;

figure(2);
set(gca,'Fontsize',18);
bar(trm2(:,1),trm2(:,2),'Facecolor',[0.88 0.88 0.88],'Linewidth',2);
hold on;
plot([-1 1],[5 5],'k--','Linewidth',4);
set(gca,'Xtick',[-1 -0.5 0 0.5 1]);
set(gca,'Ytick',[0 1 2 3 4 5 6 7]);
xlabel('position $x$','interpreter','latex');
ylabel('density of molecules','interpreter','latex');
axis([-1 1 0 7.5]);
set(gca,'Fontsize',18);




