////////////////////////////////////////////////////////
//   trafic routier 
// demarrage à un feu
////////////////////////////////////////////////////////
alphaC=10;alphaV=40;
function uval=Fval(alpha)
    uval=0;
    if (alpha>alphaC) then
      uval=1-exp(-(alpha-alphaC)/(alphaV-alphaC))
    end
endfunction
N=50;alphainf=60;V=30;alphainit=5;dt=0.2;Vinf=V*Fval(alphainf);Tfin=100;
Kmax=floor(Tfin/dt)
Pos=zeros(Kmax+1,N)
Pos(1,:)=linspace(0,alphainit*(N-1),N);
Pos(:,N)=(linspace(alphainit*(N-1),alphainit*(N-1)+Vinf*Tfin,Kmax+1))'
figure(1)
for k=1:Kmax
 drawlater      
 for n=N-1:-1:1
     Pos(k+1,n)=Pos(k,n)+dt*(V*Fval(Pos(k,n+1)-Pos(k,n)))
 end
 clf()
 plot2d(Pos(k+1,:),50*ones(1,N),-1,rect=[0,0,700,100]) 
 drawnow
end
///////////////
figure(2)
clf()
for k=1:Kmax
   plot2d(Pos(k+1,:),k*dt*ones(1,N),-1,rect=[0,0,700,100])       
end
//
