%plot of G_b(eta) for fire-diffuse-fire model
clear

set(0,                           ...
   'defaultaxesfontsize', 20,   ...
   'defaultaxeslinewidth', 1.2, ...
   'defaultlinelinewidth', 2.0, ...
   'defaultpatchlinewidth', 0.7); 

cmykflg=0;
%if cmykflg=1, this code will make cmyk figure files
%cmykflg = 1;

  etvals = 1000;
deta = 0.025;
 
N = 1000;
n = [1:N]'*ones(1,etvals);
eta = ones(N,1)*[1:etvals]*deta;  % eta = delta tau
bvals = [0.01, 0.05,0.25];
 
for bn = 1:3
   b = bvals(bn); 
    

f=exp(-n./(4*eta)- 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',22)
ylabel('\theta = g_\beta(\delta\tau)','fontsize',22)
 text(10,0.8,'\beta = 0.01','fontsize',20)
 text(10,0.63,'\beta = 0.05','fontsize',20)
 text(10,0.12,'\beta = 0.25','fontsize',20)
axis([0 20 0 1])
 if(cmykflg==1)
  print('../../figs_c/chapt_8/g_of_eta','-deps','-cmyk')
   end 
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',22)
xlabel('\theta = c^*L/\sigma','fontsize',22)
text(0.05,0.6,'\beta = 0.25','fontsize',20)
text( 0.49,0.5,'\beta = 0.05','fontsize',20)
text( 0.78,0.8,'\beta = 0.01','fontsize',20)
axis([0 1 0 10])
if(cmykflg==1)
  print('../../figs_c/chapt_8/v_vs_cstar','-deps','-cmyk')
   end 
end
hold off

