# [Scilab-users] Covid19 model

 Classic List Threaded
3 messages
Reply | Threaded
Open this post in threaded view
|

## [Scilab-users] Covid19 model

 Hi Scilabers On 17. April I sent an email, but I think it wasn't released to the mailing list, I only find it online here: http://mailinglists.scilab.org/Scilab-users-Covid19-model-td4040626.html Here's the email again (without attachment, see above link if you'd like to view the attachment) A friend (Lars Risbo) published some MATLAB code in LinkedIn for simulating the infection with a company lockdown after some time. I figured I'd try to convert it to Scilab. The code uses ODE45 and I'm not sure that I understand how to convert this MATLAB code to Scilab. I hope you can explain what I need to do to make the code work. Some of the original MATLAB code is found in the comments. ```// covid19risbo.sce // // SEIRsim1 // Susceptible-Exposed-Infectious-Recovered (SEIR) function dydt=odefun(t, y) if t
Reply | Threaded
Open this post in threaded view
|

## Re: Covid19 model

 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 : ```function dydt=odefun(t, y) if t
Reply | Threaded
Open this post in threaded view
|

## Re: Covid19 model

 Hi Stéphane Thank you for showing me how to work ODE. P.S. about Corona modeling, the model by Risbo is nice in that you can implement a lockdown of some sort. It's a simple one-step lockdown, where you have to tune the R-value ... in reality each geographic area is different, related to how much of a lockdown is executed, how dense the population is, etc. Cheers, Claus On 4/30/2020 4:51 PM, Stéphane Mottelet wrote: 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 : ```function dydt=odefun(t, y) if t