function Figure3_3b

close all;
rand('state',5);

D=0.0001;         % 10^{-4} mm^2 sec^{-1}

h=0.025;

numberofrealisations=10;
Xinitial=0.4;

for i=1:numberofrealisations
        
    if (i<=numberofrealisations/2)
        X=Xinitial-h/2;
    else
        X=Xinitial+h/2;
    end;
    time=0;
    k=1;
    Xplot(i,k)=X;
    timeplot(i,k)=time;
    
    while (k<320)
          rr=rand(2,1);
          a0=2*D/(h*h);          
          time=time+(1/a0)*log(1/rr(1));
          if (rr(2)*a0<D/(h*h))
              X=X-h;
          else
              X=X+h;
          end;
          if (X<0)
              X=h/2;
          end;
          if (X>1)
              X=1-h/2;
          end;
          k=k+1;
          Xplot(i,k)=X;
          timeplot(i,k)=time;
    end;
end;

timeplot=timeplot/60;

figure(1);
set(gca,'Fontsize',20);
h=stairs(Xplot(1,:),timeplot(1,:));
set(h,'Color',[0.9 0.9 0]);   
hold on;
h=stairs(Xplot(2,:),timeplot(2,:));
set(h,'Color','k');   
h=stairs(Xplot(3,:),timeplot(3,:));
set(h,'Color',[0.3 0.6 0.9]);   
h=stairs(Xplot(4,:),timeplot(4,:));
set(h,'Color','m');   
h=stairs(Xplot(5,:),timeplot(5,:));
set(h,'Color','c');   
h=stairs(Xplot(6,:),timeplot(6,:));
set(h,'Color','r');   
h=stairs(Xplot(7,:),timeplot(7,:));
set(h,'Color','b');   
h=stairs(Xplot(8,:),timeplot(8,:));
set(h,'Color',[0.6 0.9 0.3]);   
h=stairs(Xplot(9,:),timeplot(9,:));
set(h,'Color',[0.9 0.3 0.6]);   
h=stairs(Xplot(10,:),timeplot(10,:));
set(h,'Color','g');   
xlabel('x [mm]');
ylabel('time [min]');
set(gca,'XTick',[0 0.2 0.4 0.6 0.8 1]);
set(gca,'YTick',[0 2 4 6 8 10 12 14]);
axis([0 1 0 14]);
