[Scilab-users] Covid19 model

Stéphane Mottelet stephane.mottelet at utc.fr
Thu Apr 30 16:51:23 CEST 2020


Hi Clauss,

Just modify the following lines :

t1  =  0:0.1:60;
y1  =  ode(y0,  0,  t1,  odefun);  // [t1,y1] = ode45(@odefun,[0 60],y0); // run 1st scernario
idx=[3:6];
scf();
a  =  gca();
plot(Begin+t1,y1(idx,:),'-');  // semilogy(Begin+t1,y1(:,idx),'-','LineWidth',3) And you will be fine. ode() needs a vector of time values and the output is oriented transposed w.r.t Matlab output.

S.

Le 30/04/2020 à 16:40, Claus Futtrup a écrit :
> functiondydt=odefun(t, y)ift<daysR=R0;elseR=0.6;// Change reproductive 
> rate after 
> lockdownendA=[00-delta*R*y(1)/Npop000;...0-gamdelta*R*y(1)/Npop000;...0gam-delta000;...00delta*(1-Fhosp)000;...00delta*Fhosp0-1/Thosp0;...00delta*R*y(1)/Npop000];dydt=A*y;endBegin=datenum(2020,02,20,0,0,0);// 
> begin dateDlock=datenum(2020,03,12,0,0,0);// date of 
> lockdowndays=Dlock-Begin;R0=2.6;// inital R valuegam=1/3;// gamma, the 
> inverse of average latent timedelta=1/5;// inv time constant which 
> infectious people either recover or enter hospitalFhosp=0.16;// 
> fraction of recovering people going to hospitalThosp=14;// average 
> time of hospitalisationNpop=6e6;// total initial population of 
> sensitivey0=[Npop;50;50;0;0;0];// [S E I R Hosp ] intial 
> cond.t1=0:60;y1=ode(y0,0,60,odefun);// [t1,y1] = ode45(@odefun,[0 
> 60],y0); // run 1st 
> scernarioidx=[3:6];scf();a=gca();plot(Begin+t1,y1(:,idx),'-');// 
> semilogy(Begin+t1,y1(:,idx),'-','LineWidth',3)a.log_flags="nln";xlabel('Date')ylabel('Number 
> of cases')xgrid();// ax=gca;// ax.YLim=[10 
> max(max(y2(:,idx)))];xtitle({'Danish Corona lock down on 20.03.12, vs 
> 14 days later','R goes from 2.6 to 0.6 at 
> lockdown'});legend('Infected','Recovered','Hospitalised','Total Cases');

-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20200430/afba85b1/attachment.htm>


More information about the users mailing list