%plot of G_b(eta) for fire-diffuse-fire model
clear
 set(0,                           ...
   'defaultaxesfontsize', 20,   ...
   'defaultaxeslinewidth', 1.2, ...
   'defaultlinelinewidth', 2.0, ...
   'defaultpatchlinewidth', 0.7); 

  etvals = 1000;
deta = 0.025;  
 
N = 1000;
n = [1:N]'*ones(1,etvals);
eta = ones(N,1)*[1:etvals]*deta;
bvals = [0.01, 0.05,0.25];
b = bvals(2);

vvals = [-0.1, 0,0.1];
for bn = 1:3
   v = vvals(bn); 
    

f= exp(-(n-n.*v.*eta).^2./(4*eta.*n)- b^2*n.*eta)./(sqrt(4*pi*n.*eta));
fs=sum(f);
[mx,indx] = max(fs)


figure(1)
plot([1:indx]*deta,fs([1:indx]),[indx:etvals]*deta,fs([indx:etvals]),'--','linewidth',2)
hold on
xlabel('\delta\tau ','fontsize',20)
ylabel('\theta = g_\beta(\delta\tau)','fontsize',20)
 text(7,1.22,'v = 0.1','fontsize',20)
 text(6,0.75,'v = 0','fontsize',20)
 text(6,0.47,'v = -0.1','fontsize',20)
% text(0.202,0.014,'v = -1','fontsize',20)
 axis([0 20 0 1.4])

figure(2)
plot(fs([1:indx]),1./([1:indx]*deta),fs([indx:etvals]),1./([indx:etvals]*deta),'--','linewidth',2)

hold on
ylabel('1/\delta\tau','fontsize',20)
xlabel('\theta = c^*L/\sigma','fontsize',20)
 text(1.1,1,'v = 0.1','fontsize',20)
 text( 0.74,2.2,'v = 0','fontsize',20)
 text( 0.25,0.74,'v = -0.1','fontsize',20)
% text( 0.013,3,'v = -1','fontsize',20)
axis([0 1.5 0 12])
annotation('textarrow',[.5,.45],[.28,.21])
end

