[Scilab-users] Corona modelling
Perrichon
perrichon.pierre at wanadoo.fr
Wed May 20 16:17:33 CEST 2020
Dear,
I understand Samuel, but not sure that this kind of example on C-19 is the most representative of a GUI with Scilab.
Confusion is done on what is on the screen, and ridiculus analysis when experts are always studing in the whole word !
Where is the message : scilab solve C-19 ??? I dream.
So this is is a bad example.
De : users <users-bounces at lists.scilab.org> De la part de Samuel Gougeon
Envoyé : mercredi 20 mai 2020 15:50
À : users at lists.scilab.org
Objet : Re: [Scilab-users] Corona modelling
Hello,
Thank you Stéphane for this nice example of applied GUI.
The screenshot of the Xcos model from Hervé is also quite stimulating.
About the GUI run on Scilab 6.1.0, i have noticed that the Scilab filebrowser is blinking when using any of both sliders, as if it was updated/redisplayed for each slider step. It continues to blink for a while even after stopping using the control, likely until all queued steps are performed. This behavior can be seen when sliding with the mouse, as well as with arrows, but not with page_up and page_down keys. So, apparently only performing small steps triggers it.
Does anyone confirm this behavior, or is it only on my PC on Windows7 ?
Best regards
Samuel
Le 30/03/2020 à 08:13, Stéphane Mottelet a écrit :
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)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20200520/943d8148/attachment.htm>
More information about the users
mailing list