[Scilab-users] Use of show_pixmap() obsolete. Alternative??

Samuel Gougeon sgougeon at free.fr
Fri Nov 9 01:25:00 CET 2012


Here it is, working for me with Scilab 5.4.0 / window 7 64 bits:
-------------------

// 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;        // CANCELLED
clf(f0);
//show_window();     // CANCELLED

//
//  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();       // CANCELLED

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)
     drawlater()          // <<<<<<
     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();       // CANCELLED
     uold=u;
     drawnow()         // <<<<<<
     sleep(30);         // <<<<<<
end


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20121109/115d39db/attachment.htm>


More information about the users mailing list