File: Sfgrayplot.sci

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (36 lines) | stat: -rw-r--r-- 1,061 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function []=Sfgrayplot(x,y,f,strf,rect,aaint)
// Like fgrayplot but the function fec is used to smooth the 
// result 
// f is evaluated on the grid x.*.y 
// anf the result is plotted assuming that f is linear on the triangles 
// built on the grid 
// 
// ______ 
// | /| /|
// |/_|/_|  
// | /| /|
// |/_|/_|
//!
// Copyright INRIA
[lhs,rhs]=argn(0);
if rhs<=0,s_mat=['deff(''[z]=surf(x,y)'',''z=x**3+y'');';
                'Sfgrayplot(-1:0.1:1,-1:0.1:1,surf);'];
         write(%io(2),s_mat);execstr(s_mat);
         return;end;
if rhs <= 3,strf="121";end
if rhs <= 4,rect=[-1,-1,1,1];end
if rhs <= 5,aaint=[10,2,10,2];end
if type(f)==11 then comp(f),end;
p=prod(size(x));
q=prod(size(y));
noe_x = ones(y).*.x;
noe_y = y.*.ones(x);
fun = feval(x,y,f);
fun = matrix(fun,p*q,1);
xxb=(1:p-1)';xx=[];
for i=0:q-2; xx=[ xx; xxb+p*i*ones(xxb)];end
[Ntr,vv]=size(xx);
trianl=[(1:Ntr)',xx,xx+ones(xx),xx+(p+1)*ones(xx),0*ones(xx)];
trianl=[trianl;(Ntr+1:2*Ntr)',xx,xx+(p)*ones(xx),xx+(p+1)*ones(xx),0*ones(xx)];
fec(noe_x',noe_y',trianl,fun,strf," ",rect,aaint)