[Scilab-users] update script to Scilab 6.00

Pierre Payen payen.pierre at gmail.com
Tue Sep 26 14:08:25 CEST 2017


function dy=fon(t,y,g,l) // get rid of global variable
dy(1) = y(2);
dy(2)=-g/l*sin(y(1));
endfunction
 
teta_init = 45;
teta_init=teta_init/180*%pi;
dteta_init = 0;
g=9.81;
l=1;
t=0:0.1:20;
y=ode([teta_init;dteta_init],0,[t],list(fon,g,l)); // pass g,l as parameter
 
//Preparation du graphe
f = gcf(); // on recupere le handle de la fen^etre graphique
f.background = color("white");
//FIN Preparation du graphe

i = 1;
xtitle('', 'm', 'm');  
a = gca(); // On récupère l'objet graphique axes pour modifier les légendes
a.isoview = "on"; 
a.data_bounds = [-2 2 -2 2]; 
a.title.text = "Le pendule";

a.title.font_size = 4;
a.title.foreground = color("white");
a.background = color("white");

xpoly([0  +l*sin(y(1,i))],[0 -l*cos(y(1,i))],"lines",0)
hline= gce(); // On récupère l'objet graphique double-pendule atwood
            // pour modifier son aspect cosmétique
hline.thickness = 3;
hline.foreground = color("blue");
 
plot([+l*sin(y(1,i))],[-l*cos(y(1,i))],'o','MarkSize',10,'MarkBackground','b')
h=gce()
hpoint=h.children
xgrid(12)

while i<=length(y)  
  i = i+1;  
  hline.data=[0,0;0+l*sin(y(1,i)),0-l*cos(y(1,i))] // update coordinate of
the polyline without clearing the figure
  hpoint.data=[+l*sin(y(1,i)),-l*cos(y(1,i))]        // same
end



--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html



More information about the users mailing list