[Scilab-users] Corona modelling

Rafael Guerra jrafaelbguerra at hotmail.com
Mon Mar 30 11:42:36 CEST 2020


Merci Stéphane, for the very interesting code and Heinz for the reference to the math behind the epidemy “curve”, or one of its models.



From: users <users-bounces at lists.scilab.org> On Behalf Of Stéphane Mottelet
Sent: Monday, March 30, 2020 9:14 AM
To: users at lists.scilab.org
Subject: Re: [Scilab-users] Corona modelling


Hello Heinz,

Here is an interactive version (made for my children last week...) :



// Confinement COVID-19 !

// Stephane MOTTELET, UTC

// Tue Mar 24 08:55:03 CET 2020

//

function dydt=sir(t, y, bet, gam, N)

    dydt=[-bet/N*y(1)*y(2)

           bet/N*y(1)*y(2)-gam*y(2)

           gam*y(2)];

endfunction



function draw(bet, gam)

    t=0:1:360;

    N=6e7;

    if exists("gcbo") && is_handle_valid(gcbo)

        sb = gcbo;

        if sb.tag=="beta"

            bet=sb.value;

            gam=findobj("gamma").value

        else

            gam=sb.value;

            bet=findobj("beta").value

        end

        y=ode('stiff',[N-1;1;0],0,t,list(sir,bet,gam,N));

        curves = findobj("curves");

        curves.children(1).data(:,2)=y(3,:);

        curves.children(2).data(:,2)=y(2,:);

        curves.children(3).data(:,2)=y(1,:);

    else

        y=ode('stiff',[N-1;1;0],0,t,list(sir,bet,gam,N));

        scf(0)

        clf

        plot(t,y)

        gce().tag="curves";

        gce().children.thickness=2;

        legend("Susceptible","Infected","Recovered",-1)



        sb1 = uicontrol("style","slider",...

        "units","normalized",...

        "Position", [0.85,0.2,0.05,0.48],...

        "BackgroundColor", [1,1,1],...

        "Callback_Type",12,...

        "sliderstep",[1/1000,1/10],...

        "min",0.15,"max",0.3,"value",bet,...

        "Callback","draw","tag","beta");



        uicontrol("style","text",...

        "string","$\beta$",...

        "units","normalized",...

        "Position", [0.85,0.125,0.05,0.08],...

        "BackgroundColor", [1,1,1],...

        "HorizontalAlignment","center");



        sb1 = uicontrol("style","slider",...

        "units","normalized",...

        "Position", [0.90,0.2,0.05,0.48],...

        "BackgroundColor", [1,1,1],...

        "Callback_Type",12,...

        "sliderstep",[1/1000,1/10],...

        "min",0,"max",1/15,"value",gam,...

        "Callback","draw","tag","gamma");



        uicontrol("style","text",...

        "string","$\gamma$",...

        "units","normalized",...

        "Position", [0.9,0.125,0.05,0.08],...

        "BackgroundColor", [1,1,1],...

        "HorizontalAlignment","center");



    end

end



clf



draw(0.3,1/15)


Le 30/03/2020 à 02:14, Heinz Nabielek a écrit :

Colleagues:



is there an straightforward Scilab approach for solving the three coupled nonlinear differential equations of first order given by the Standard Model of Epidemics?





S= number Susceptible:          S'=-aSI

I=  number Infected:            I'=aSI - bI

R= number Recovered:            R'=bI

whereby 'a' is the transmission coefficient, 'b' the recovery factor (after Reed-Frost 1928).

Initial values for S, I, R are available.



Thank you

Heinz

_______________________________________________

users mailing list

users at lists.scilab.org<mailto:users at lists.scilab.org>

https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users

--

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/20200330/678d2f2d/attachment.htm>


More information about the users mailing list