next up previous
Next: A more complex example Up: Finite Elements Previous: A small example of

Another mesh example

getf('SCI/demos/fec/macros.sci')
// compute the mesh
N=20;n=1:N;
x=cos(n*2*%pi/N); y=sin(n*2*%pi/N);
noeul=[(1:(N))', x', y',zeros(N,1);
       (N+1),    0,  0, 0];
trianl=[];
for i=1:(N-1), trianl=[trianl;i,i,i+1,N+1,0]; end
trianl=[trianl;N,N,1,N+1,0];
// Set the colormap
xset("colormap",hotcolormap(N));
// the mesh picture
xsetech([0,0,1.0,3/4]) // use the upper part of graphic window
rect=[-1.2,-1.2,1.2,1.2];
fec(noeul(:,2),noeul(:,3),trianl,(1:N+1)',"030"," ",rect);
meshvisu(3,rect) // the mesh
// second picture to show the color scales
xsetech([0,3/4,1,1/5]) ; // use the lower part of graphic window
Matplot((1:xget("lastpattern")),"011",[0,0.5,N+2,1.5],[1,N+2,1,1]);
\fbox{\epsfig{file=foo0_38.eps,width=3.75in}}

Scilab group