function Figure6_4

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

close all;

results=load('data_Figure6_4_a.dat');
resultsbeta0275=load('data_Figure6_4_b.dat');
Ms=0.25+(besseli(0,8)+besseli(2,8))/besseli(1,8);
set(groot,'defaultAxesTickLabelInterpreter','latex');

figure(1);
set(gca,'Fontsize',18);
hh1=semilogx(1./[1 50],[Ms Ms],'g','Linewidth',3');
hold on;
hh3=semilogx(1./resultsbeta0275(:,1),resultsbeta0275(:,2),'ok','Markersize',2,'Linewidth',3);
semilogx([0.0275 0.0275],[2 3.3],'b--','Linewidth',2);
hh2=semilogx(1./results(:,1),results(:,2),'or','Markersize',2,'Linewidth',3);
hl=legend([hh1,hh2,hh3],'$M_s$','$\beta=0$','$\beta=0.275$');
set(hl,'interpreter','latex','Fontsize',18,'location','northeast');
xlabel('$h$ [$\mu$m]','interpreter','latex');
ylabel('$M(h)$','interpreter','latex');
set(gca,'XTick',[0.028 0.1 0.3 1]);
set(gca,'XTickLabel',{'$h_{\rm crit}$' '$10^{-1}$' '$3${}$\times${}$10^{-1}$' '$10^0$'});
axis([0 1 2 3.2]);
set(gca,'Fontsize',18);
