[scilab-Users] Doubt in plot3d

Samuel Gougeon Samuel.Gougeon at univ-lemans.fr
Mon May 18 10:51:39 CEST 2009


Hi,

Lucio Agostinho Rocha <outrosdiasvirao at yahoo.com.br> a écrit :

> Hi,
>
> I'm trying to plot the following function in Scilab:
>
> x=[-1:0.01:1];
> y=[-1:0.01:1];
> g = x .* sin(4 .* %pi .* x) - y .* sin ( 4 .* %pi .* y + %pi ) + 1;
> plot3d(x,y,g)
>
> but nothing is displayed. What i'm doing wrong? Someone could help  
> me? If yes, how can I put a degrade with several colors?

x as well as y must be matrices for calculating g in this way:
clf;
X=[-1:0.01:1];
Y=[-1:0.01:1];
x=ones(length(Y),1)*X;
y=Y'*ones(1,length(X));
g = x .* sin(4 .* %pi .* x) - y .* sin ( 4 .* %pi .* y + %pi ) + 1;
plot3d(X,Y,g)

should work and fairly uses Scilab's efficiency for internal matrix
calculation

Regards
Samuel




More information about the users mailing list