File: fplot2d.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 (33 lines) | stat: -rw-r--r-- 1,035 bytes parent folder | download
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
function []=fplot2d(xr,f,style,strf,leg,rect,nax)
// Dessin d'une courbe 2D d\'efinie par un external f 
// on trace un aproximation lin\'eaire par morceaux de la courbe
// y=f(x), passant par les points (xr(i),f(xr(i)))
// xr est donc un vecteur implicite donnant les points ou l'on calcule f.
// pour les autres arguments qui sont optionnels, on se reportera \`a
// plot2d.
// Exemple~: taper fplot2d() pour voir un exemple.
// deff('<y>=f(x)','y=sin(x)+cos(x)');
// fplot2d(f,0:0.1:%pi);
//!
// Copyright INRIA
[lhs,rhs]=argn(0)
if rhs<=0,
  s_mat=['deff(''[y]=f(x)'',''y=sin(x)+cos(x)'');';
      'fplot2d(0:0.1:%pi,f);'];
  write(%io(2),s_mat);execstr(s_mat);
  return;
end;
if rhs < 2 then 
  xx=[' I need at least 2 arguments';
      ' or zero  a demo'];
  write(%io(2),xx);
  return;
end
if rhs < 3,style=1,end
if rhs < 4,strf="021",end
if rhs < 5,leg=" ",end
if rhs < 6,rect=[0,0,10,10],end
if rhs < 7,nax=[2,10,2,10],end
[p1,p2]=size(xr);
if p1==1 , xr=xr';[p1,p2]=size(xr);end
plot2d(xr,feval(xr,f),style,strf,leg,rect,nax)