index 144b4f9..c6c72c1 100644 (file)
@@ -92,7 +92,18 @@ deff("z=f(x,y)","z=x.^2 + y.^3")
Z = f(X,Y);
clf()
plot3d(x,y,Z, flag=[2 6 4]); show_window()
-
+ ]]></programlisting>
+        <scilab:image>
+nx = 40; ny = 40;
+x = linspace(-1,1,nx);
+y = linspace(-1,1,ny);
+[X,Y] = ndgrid(x,y);
+//deff("z=f(x,y)","z=128*x.^2 .*(1-x).^2 .*y.^2 .*(1-y).^2");
+deff("z=f(x,y)","z=x.^2 + y.^3")
+Z = f(X,Y);
+plot3d(x,y,Z, flag=[2 6 4]); show_window()
+        </scilab:image>
+        <programlisting role="example"><![CDATA[
// criando um grid 3d simples
nx = 10; ny = 6; nz = 4;
x = linspace(0,2,nx);
@@ -115,6 +126,28 @@ clf()
plot3d(XF,YF,ZF, flag=[0 6 3], leg="X@Y@Z")
xtitle("A 3d grid !"); show_window()
]]></programlisting>
+        <scilab:image>
+nx = 10; ny = 6; nz = 4;
+x = linspace(0,2,nx);
+y = linspace(0,1,ny);
+z = linspace(0,0.5,nz);
+[X,Y,Z] = ndgrid(x,y,z);
+// tente exibir este grid 3d...
+XF=[]; YF=[]; ZF=[];
+for k=1:nz
+   [xf,yf,zf] = nf3d(X(:,:,k),Y(:,:,k),Z(:,:,k));
+   XF = [XF xf]; YF = [YF yf]; ZF = [ZF zf];
+end
+for j=1:ny
+   [xf,yf,zf] = nf3d(matrix(X(:,j,:),[nx,nz]),...
+                     matrix(Y(:,j,:),[nx,nz]),...
+                     matrix(Z(:,j,:),[nx,nz]));
+   XF = [XF xf]; YF = [YF yf]; ZF = [ZF zf];
+end
+clf()
+plot3d(XF,YF,ZF, flag=[0 6 3], leg="X@Y@Z")
+xtitle("A 3d grid !"); show_window()
+        </scilab:image>
</refsection>
<refsection role="see also">
<title>Ver TambĂ©m</title>