Add an image for the ndgrid
[scilab.git] / scilab / modules / elementary_functions / help / pt_BR / elementarymatrices / ndgrid.xml
index da1f453..c6c72c1 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:id="ndgrid" xml:lang="en">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="ndgrid" xml:lang="en">
     <refnamediv>
         <refname>ndgrid</refname>
         <refpurpose>Arrays para avaliação de função multidimensional em
@@ -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>