% plot invasion profile

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

 

x = [-5.001:.01:5];
 
bet = -2; %this is the drift velocity
bet = 0;
 
bsq = sqrt(bet^2+4);

kp = (bsq+bet)/2
km = (bsq-bet)/2

f = (x>=0).*(exp(-km*x))/(km*bsq)...
    + (x<0).*(1/(km*bsq) + (1-exp(kp*x))/(kp*bsq));
sum(f)*0.01
%f = (1+sign(-x))/2+sign(x).*exp(-abs(x))/2;
figure(1)
 
    plot(x,f, 'linewidth',2)

 
xlabel('\alpha x','fontsize',20)
ylabel('u_{n+1}/A_0','fontsize',20)
  
%   text(1.25,0.2,'\beta=0','fontsize',20)
 set(gca,'Xtick',-5:2.5:5)
  
g = exp(-(bsq*abs(x)-bet*x)/2)/bsq;
figure(2)
 
    plot(x,g, 'linewidth',2)
 
xlabel('\alpha x','fontsize',20)
ylabel('K(x)/\alpha','fontsize',20)
 set(gca,'Xtick',-5:2.5:5)
  
   
 
