[Scilab-users] Use of show_pixmap() obsolete. Alternative??
Eliseo Chacon Vera
eliseo at um.es
Thu Nov 8 23:01:09 CET 2012
Dear Samuel,
thanks for your quick answer. The following lines solve the heat equation and provides
a smooth evolution for the plot. SCILAB 5.4.0 does not like it.
thanks,
eliseo
///
// heat equation
//
clear;
//
// Initial value
//
function z=u0(xx)
if (abs(xx)<=1) then
z=1;
else
z=0;
end
endfunction
//
// b heat coef.
//
b=1;
f0=scf(0);
f0.pixmap='on';
clf(f0);
show_window();
//
// space interval
//
xmin=-5;
xmax=5;
Nx=125; // Number of points
h=(xmax-xmin)/Nx;
x=xmin:h:xmax;
//
u=zeros(1,Nx+1);
uold=zeros(1,Nx+1);
u2=zeros(1,Nx+1); // dimensionamos inicialmente a cero
uold2=zeros(1,Nx+1);
ucero=zeros(1,Nx+1);
//
// time
//
t0=0;
time=t0;
for i=1:Nx+1
uold(i)=u0(x(i)); // initial value
uold2(i)=u0(x(i));
ucero(i)=u0(x(i));
end
plot(x,uold,'dr')
ejes=gca();
ejes.data_bounds=[xmin, 0; xmax,1.2];
title(" Initial data ");
show_pixmap();
sleep(1000);
k=0.9*h^2/(2*b);// stability
//
// coeficiente mu=k/h^2
//
mu=k/h^2;
//
coef1=b*mu;
coef2=1-2*b*mu;
coef3=b*mu;
//
while (time<0.5)
time=time+k;
u(1)=0;
u(Nx+1)=0;
for i=2:Nx
u(i)=coef1*uold(i+1)+coef2*uold(i)+coef3*uold(i-1);
end
clf(f0);
plot(x,u,'or',x,ucero,'db');
ejes=gca();
ejes.data_bounds=[xmin, 0; xmax,1.2];
title("Euler explicit: time= "+string(time)..
+"; time step = "+string(k)+..
+"; spatial h="+string(h)+"; diffusion = "+string(b));
legend('b=1','initial');
show_pixmap();
uold=u;
sleep(1);
end
Saludos,
Eliseo Chacon Vera
Departamento de Matemáticas
Facultad de Matematicas. Universidad de Murcia
Postal Address: Campus de Espinardo, 30100-Espinardo-Murcia
Phone: (34) 868 884175 fax: (34) 868 884182
email: eliseo at um.es
Freefem Wiki: http://www.um.es/freefem/ff++/pmwiki.php
Web site: http://webs.um.es/eliseo/
El 08/11/2012, a las 20:01, Samuel GOUGEON [via Scilab / Xcos - Mailing Lists Archives] escribió:
> Le 08/11/2012 17:59, Eliseo Chacon Vera a écrit :
> > could anyone give me one?? I can't do it with the drawnow/drawlater option.
> Why not? It's difficult to help you more without knowing the code of
> your temptative...
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
>
>
> If you reply to this email, your message will be added to the discussion below:
> http://mailinglists.scilab.org/Use-of-show-pixmap-obsolete-Alternative-tp4025179p4025182.html
> To start a new topic under Scilab users - Mailing Lists Archives, email ml-node+s994242n2602246h85 at n3.nabble.com
> To unsubscribe from Use of show_pixmap() obsolete. Alternative??, click here.
> NAML
--
View this message in context: http://mailinglists.scilab.org/Use-of-show-pixmap-obsolete-Alternative-tp4025179p4025184.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20121108/6c6f0f75/attachment.htm>
More information about the users
mailing list