1
function []=fplot2d(xr,f,style,strf,leg,rect,nax,void)
2
// 2D plot of function f : a Scilab function or the name (as a string)
3
// of a dynamically linked function.
4
// Enter fplot2d() for an example.
5
// deff('<y>=f(x)','y=sin(x)+cos(x)');
6
// fplot2d(f,0:0.1:%pi);
11
s_mat=['deff(''[y]=f(x)'',''y=sin(x)+cos(x)'');';
12
'fplot2d(0:0.1:%pi,f);'];
13
write(%io(2),s_mat);execstr(s_mat);
16
if type(xr)=='10' then // logflag passed first
17
error('First argument must be the discretization of x')
19
error('at least 2 input arguments required')
21
//handling optionnal arguments
23
if exists('style','local')==1 then opts=[opts,'style=style'],end
24
if exists('strf','local')==1 then opts=[opts,'strf=strf'],end
25
if exists('leg','local')==1 then opts=[opts,'leg=leg'],end
26
if exists('rect','local')==1 then opts=[opts,'rect=rect'],end
27
if exists('nax','local')==1 then opts=[opts,'nax=nax'],end
28
if exists('logflag','local')==1 then opts=[opts,'logflag=logflag'],end
29
if exists('frameflag','local')==1 then opts=[opts,'frameflag=frameflag'],end
30
if exists('axesflag','local')==1 then opts=[opts,'axesflag=axesflag'],end
31
if size(opts,2)<rhs-2 then error('invalid named arguments'),end
32
execstr('plot2d(xr,feval(xr,f),'+strcat(opts,',')+')')