function Figure8_3

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

close all;
format long

beta=1;
dt=0.01;
finaltau=5;
tau=[0:dt:finaltau];
fac=2*beta/pi;

omegam=1;
unifkappa1=fac*sin(2*omegam*tau)./(2*tau);
expkappa1=(fac)*omegam./(1+omegam*omegam*tau.*tau);

omegam=2;
unifkappa2=fac*sin(2*omegam*tau)./(2*tau);
expkappa2=(fac)*omegam./(1+omegam*omegam*tau.*tau);

omegam=3;
unifkappa3=fac*sin(2*omegam*tau)./(2*tau);
expkappa3=(fac)*omegam./(1+omegam*omegam*tau.*tau);

figure(1);
set(gca,'Fontsize',18);
plot(tau,unifkappa1,'k','Linewidth',2);
hold on;
plot(tau,unifkappa2,'g--','Linewidth',2);
plot(tau,unifkappa3,'r-.','Linewidth',2);
plot([0 finaltau],[0 0],'k');
axis([0 4 -fac*0.67 fac*3]);
xlabel('$\tau$','interpreter','latex');
ylabel('$\kappa_{\rm u}(\tau)$','interpreter','latex');
h=legend('$\omega_{\rm m}=1$','$\omega_{\rm m}=2$','$\omega_{\rm m}=3$');
set(h,'interpreter','latex','Fontsize',18);
set(gca,'Xtick',[0 1 2 3 4 5 6 7]);
set(gca,'Ytick',[0 0.5 1 1.5 2]);
box on;
set(gca,'Fontsize',18);

figure(2);
set(gca,'Fontsize',18);
plot(tau,expkappa1,'k','Linewidth',2);
hold on;
plot(tau,expkappa2,'g--','Linewidth',2);
plot(tau,expkappa3,'r-.','Linewidth',2);
plot([0 finaltau],[0 0],'k');
axis([0 4 0 fac*3.05]);
xlabel('$\tau$','interpreter','latex');
ylabel('$\kappa_{\rm e}(\tau)$','interpreter','latex');
h=legend('$\omega_{\rm m}=1$','$\omega_{\rm m}=2$','$\omega_{\rm m}=3$');
set(h,'interpreter','latex','Fontsize',18);
set(gca,'Xtick',[0 1 2 3 4 5 6 7]);
set(gca,'Ytick',[0 0.5 1 1.5 2]);
box on;
set(gca,'Fontsize',18);
