* Bug 7967 fixed [doc]: size(meshgrid(..)) better documented 15/21215/7
Samuel GOUGEON [Sat, 11 Jan 2020 22:00:33 +0000 (23:00 +0100)]
  http://bugzilla.scilab.org/7967

  meshgrid() page overhauled (PDF): http://bugzilla.scilab.org/attachment.cgi?id=5053

Change-Id: I95a373418557ca36bb22fcadad4797228eb88318

scilab/CHANGES.md
scilab/modules/elementary_functions/help/en_US/elementarymatrices/meshgrid.xml
scilab/modules/elementary_functions/help/fr_FR/elementarymatrices/meshgrid.xml
scilab/modules/elementary_functions/help/ja_JP/elementarymatrices/meshgrid.xml [deleted file]
scilab/modules/elementary_functions/help/pt_BR/elementarymatrices/meshgrid.xml
scilab/modules/elementary_functions/help/ru_RU/elementarymatrices/meshgrid.xml
scilab/modules/helptools/etc/images_md5.txt
scilab/modules/helptools/images/meshgrid_1.png

index 3edf8db..d4dee33 100644 (file)
@@ -169,6 +169,7 @@ Bug Fixes
 * [#2694](http://bugzilla.scilab.org/show_bug.cgi?id=2694): `bitget` did not accept positive integers of types int8, int16 or int32.
 * [#7724](http://bugzilla.scilab.org/show_bug.cgi?id=7724): When a figure is created in .auto_resize="on" mode, its .axes_size sets its .figure_size accordingly, not the reverse. But this was not documented.
 * [#7765](http://bugzilla.scilab.org/show_bug.cgi?id=7765): `champ1()` is useless. `champ().colored` is available for a long time. 
+* [#7967](http://bugzilla.scilab.org/show_bug.cgi?id=7967): The tricky size `[ny,nx]` of `meshgrid(x,y)` results and usages with graphics was not enough documented.
 * [#8307](http://bugzilla.scilab.org/show_bug.cgi?id=8307): `list2vec()` and `vec2list()` were located in the [optimization] module instead of in [data_structures], and were missing in the `See also` section of `list()`.
 * [#8784](http://bugzilla.scilab.org/show_bug.cgi?id=8784): Automatic self-adjusting blocks `SCALE_CSCOPE` & `SCALE_CMSCOPE` in Xcos.
 * [#5512](http://bugzilla.scilab.org/show_bug.cgi?id=5512): `disp()` puzzlingly displayed arguments in reverse order.
index 1c809cb..208dcc3 100644 (file)
@@ -2,8 +2,8 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA - Farid BELAHCENE
- *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2020 - Samuel GOUGEON
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
  * pursuant to article 5.3.4 of the CeCILL v.2.1.
           xmlns:scilab="http://www.scilab.org" xml:id="meshgrid" xml:lang="en">
     <refnamediv>
         <refname>meshgrid</refname>
-        <refpurpose>create matrices or 3-D arrays</refpurpose>
+        <refpurpose>
+            Create matrices or 3-D arrays from vectors replicated in 2 or 3 dimensions
+        </refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Syntax</title>
-        <synopsis>[X, Y] = meshgrid(x)
-            [X, Y] = meshgrid(x,y)
-            [X, Y, Z] = meshgrid(x,y,z)
+        <synopsis>
+            U = meshgrid(u)
+            [U, V] = meshgrid(u)
+            [X, Y] = meshgrid(x, y)
+            [X, Y, Z] = meshgrid(x, y, z)
         </synopsis>
     </refsynopsisdiv>
     <refsection>
         <title>Arguments</title>
         <variablelist>
             <varlistentry>
-                <term>x, y, z</term>
+                <term>u, x, y, z</term>
+                <listitem>
+                    Vectors of any types, of lengths nu, nx, ny, nz.
+                    <para/>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>U, V</term>
                 <listitem>
-                    <para>vectors</para>
+                    Square matrices of size nu x nu
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>X, Y, Z</term>
                 <listitem>
-                    <para>matrices in case of 2 input arguments, else 3-D arrays in case
-                        of 3 input arguments
-                    </para>
+                    Matrices or hypermatrices of the same size
+                    [<emphasis role="bold">ny</emphasis>, nx] or
+                    [<emphasis role="bold">ny</emphasis>, nx, nz].
+                    <para/>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
     <refsection>
         <title>Description</title>
-        <para>Create matrices or 3-D arrays.</para>
+        <para>
+            meshgrid(..) builds matrices or 3-D hypermatrices by replicating input vectors
+            along 2 or 3 dimensions.
+        </para>
+        <para>
+            <note>
+                To create arrays of size [<emphasis role="bold">nx</emphasis>, ny] instead of
+                [ny, nx], or with more than 3 dimensions, please use
+                <literal>ndgrid(x, y)</literal> or <literal>ndgrid(x, y, z,..)</literal>.
+            </note>
+        </para>
+        <para>
+            <warning>
+                Most of Scilab 2D or 3D graphical functions like <literal>champ()</literal>,
+                <literal>grayplot()</literal>, <literal>Sgrayplot()</literal>,
+                <literal>plot3d()</literal>, <literal>contour()</literal>, etc.. work with grids
+                generated with <literal>ndgrid()</literal>, not from
+                <literal>meshgrid()</literal>. Data computed on grids coming from
+                <literal>meshgrid()</literal> will require being transposed (please see the
+                example thereafter).
+            </warning>
+        </para>
     </refsection>
     <refsection>
         <title>Examples</title>
         <programlisting role="example"><![CDATA[
-x = -1:0.1:1;
-[X, Y] = meshgrid(x);
+[X, Y] = meshgrid(0:2)
+ ]]></programlisting>
+    <screen>
+--> [X, Y] = meshgrid(0:2)
+ X  =
+   0.   1.   2.
+   0.   1.   2.
+   0.   1.   2.
+
+ Y  =
+   0.   0.   0.
+   1.   1.   1.
+   2.   2.   2.
+</screen>
+        <para/>
+        <programlisting role="example"><![CDATA[
+[X, Y] = meshgrid(["a" "bc" "αβγδ"], [-3 5])
+ ]]></programlisting>
+    <screen>
+--> [X, Y] = meshgrid(["a" "bc" "αβγδ"], [-3 5])
+ X  =
+!a  bc  αβγδ  !
+!a  bc  αβγδ  !
+
+ Y  =
+  -3.  -3.  -3.
+   5.   5.   5.
+</screen>
+        <para/>
+        <para>
+            Application to grids for graphics:
+        </para>
+        <programlisting role="example"><![CDATA[
+// Generating data
+x = -1:0.1:1.7;
+y = -1:0.1:1;
+[X, Y] = meshgrid(x, y);
 Z = sinc(2*%pi * X.*Y);
+
+// Setting the graphic figure
+clf
+drawlater
+gcf().color_map = parulacolormap(64);
+gcf().axes_size = [650 530];
+
+// Plotting
+subplot(2,2,1)
+Sgrayplot(x, y, Z')
+title(["Sgrayplot(x, y, Z'' ) " "$←\;Z^t\; required$"], "fontsize",3)
+isoview, colorbar
+
+subplot(2,2,2)
+plot3d(x, y, Z', -125,50)
+gce().color_flag = 1;
+title(["plot3d(x, y, Z'' ) " "$←\;Z^t\; required$"], "fontsize",3)
+isoview
+
+subplot(2,2,3)
+champ(x,y,sin(2*X'),cos(2*Y'))
+title(["champ(x, y, sin(X'' ),cos(Y'' ))" "$←\;X^t\;\;Y^t\; required$"], "fontsize",3)
+isoview
+
+subplot(2,2,4)
 surf(X, Y, Z)
+title("surf(X, Y, Z)", "fontsize",3)
+isoview
+
+gcf().children.tight_limits = ["on" "on" "on"];
+drawnow
  ]]></programlisting>
+        <para/>
         <scilab:image>
-            x = -1:0.1:1;
-            [X,Y] = meshgrid(x);
-            Z = sinc(2*%pi*X.*Y);
+            // Generating data
+            x = -1:0.1:1.7;
+            y = -1:0.1:1;
+            [X, Y] = meshgrid(x, y);
+            Z = sinc(2*%pi * X.*Y);
+
+            // Setting the graphic figure
+            clf
+            drawlater
+            gcf().color_map = parulacolormap(64);
+            gcf().axes_size = [650 530];
+
+            // Plotting
+            subplot(2,2,1)
+            Sgrayplot(x, y, Z')
+            title(["Sgrayplot(x, y, Z'' ) " "$←\;Z^t\; required$"], "fontsize",3)
+            isoview, colorbar
+
+            subplot(2,2,2)
+            plot3d(x, y, Z', -125,50)
+            gce().color_flag = 1;
+            title(["plot3d(x, y, Z'' ) " "$←\;Z^t\; required$"], "fontsize",3)
+            isoview
+
+            subplot(2,2,3)
+            champ(x,y,sin(2*X'),cos(2*Y'))
+            title(["champ(x, y, sin(X'' ),cos(Y'' ))" "$←\;X^t\;\;Y^t\; required$"], "fontsize",3)
+            isoview
+
+            subplot(2,2,4)
             surf(X, Y, Z)
+            title("surf(X, Y, Z)", "fontsize",3)
+            isoview
+
+            gcf().children.tight_limits = ["on" "on" "on"];
+            drawnow
         </scilab:image>
     </refsection>
     <refsection role="see also">
@@ -73,6 +205,9 @@ surf(X, Y, Z)
                 <link linkend="ndgrid">ndgrid</link>
             </member>
             <member>
+                <link linkend="repmat">repmat</link>
+            </member>
+            <member>
                 <link linkend="feval">feval</link>
             </member>
         </simplelist>
index deea52c..e916060 100644 (file)
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008 - INRIA - Farid BELAHCENE
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2020 - Samuel GOUGEON
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ -->
 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
           xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="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="meshgrid" xml:lang="fr">
     <refnamediv>
         <refname>meshgrid</refname>
-        <refpurpose>construit des matrices ou des tableaux 3-D</refpurpose>
+        <refpurpose>
+            construit des matrices ou hypermatrices en répliquant des vecteurs en 2 ou 3 dimensions
+        </refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Séquence d'appel</title>
-        <synopsis>[X, Y] = meshgrid(x)
-            [X, Y] = meshgrid(x,y)
-            [X, Y, Z] = meshgrid(x,y,z)
+        <synopsis>
+            U = meshgrid(u)
+            [U, V] = meshgrid(u)
+            [X, Y] = meshgrid(x, y)
+            [X, Y, Z] = meshgrid(x, y, z)
         </synopsis>
     </refsynopsisdiv>
     <refsection>
         <title>Paramètres</title>
         <variablelist>
             <varlistentry>
-                <term>x, y, z</term>
+                <term>u, x, y, z</term>
                 <listitem>
-                    <para>des vecteurs</para>
+                    Vecteurs de types quelconques, de tailles nu, nx, ny, nz.
+                    <para/>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>U, V</term>
+                <listitem>
+                    Matrices carrées, de taille nu x nu
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>X, Y, Z</term>
                 <listitem>
-                    <para>des matrices dans le cas de 2 arguments d'entrées, sinon des
-                        tableaux des tableaux 3-D dans le cas de 3 arguments
-                        d'entrées
-                    </para>
+                    Matrices ou hypermatrices de mêmes tailles
+                    [<emphasis role="bold">ny</emphasis>, nx] ou
+                    [<emphasis role="bold">ny</emphasis>, nx, nz].
+                    <para/>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
     <refsection>
         <title>Description</title>
-        <para>Construit des matrices ou des tableaux 3-D.</para>
+        <para>
+            meshgrid(..) construit des matrices ou des hypermatrices 3-D par réplication
+            en 2 ou 3 dimensions des vecteurs donnés.
+        </para>
+        <para>
+            <note>
+                Pour créer des tableaux de taille [<emphasis role="bold">nx</emphasis>, ny]
+                au lieu de [ny, nx], ou avec plus de 3
+                dimensions, utiliser <literal>ndgrid(x, y)</literal> ou
+                <literal>ndgrid(x, y, z,..)</literal>.
+            </note>
+        </para>
+        <para>
+            <warning>
+                La plupart des fonctions graphiques 2D ou 3D de Scilab telles que
+                <literal>champ()</literal>,
+                <literal>grayplot()</literal>, <literal>Sgrayplot()</literal>,
+                <literal>plot3d()</literal>, <literal>contour()</literal>, etc.. travaillent
+                directement avec des grilles de coordonnées générées par <literal>ndgrid()</literal>,
+                non de <literal>meshgrid()</literal>. Les données calculées à partir d'une
+                grille issue de <literal>meshgrid()</literal> devront être transposées
+                (voir l'exemple ci-dessous).
+            </warning>
+        </para>
     </refsection>
     <refsection>
         <title>Exemples</title>
         <programlisting role="example"><![CDATA[
-x = -1:0.1:1;
-[X,Y] = meshgrid(x);
+[X, Y] = meshgrid(0:2)
+ ]]></programlisting>
+    <screen>
+--> [X, Y] = meshgrid(0:2)
+ X  =
+   0.   1.   2.
+   0.   1.   2.
+   0.   1.   2.
+
+ Y  =
+   0.   0.   0.
+   1.   1.   1.
+   2.   2.   2.
+</screen>
+        <para/>
+        <programlisting role="example"><![CDATA[
+[X, Y] = meshgrid(["a" "bc" "αβγδ"], [-3 5])
+ ]]></programlisting>
+    <screen>
+--> [X, Y] = meshgrid(["a" "bc" "αβγδ"], [-3 5])
+ X  =
+!a  bc  αβγδ  !
+!a  bc  αβγδ  !
+
+ Y  =
+  -3.  -3.  -3.
+   5.   5.   5.
+</screen>
+        <para/>
+        <para>
+            Application aux grilles graphiques :
+        </para>
+        <programlisting role="example"><![CDATA[
+// Production des données à illustrer
+x = -1:0.1:1.7;
+y = -1:0.1:1;
+[X, Y] = meshgrid(x, y);
 Z = sinc(2*%pi * X.*Y);
+
+// Préparation de la fenêtre graphique
+clf
+drawlater
+gcf().color_map = parulacolormap(64);
+gcf().axes_size = [650 530];
+
+// Affichage graphique
+subplot(2,2,1)
+Sgrayplot(x, y, Z')
+title(["Sgrayplot(x, y, Z'' ) " "$←\;Z^t\; requis$"], "fontsize",3)
+isoview, colorbar
+
+subplot(2,2,2)
+plot3d(x, y, Z', -125,50)
+gce().color_flag = 1;
+title(["plot3d(x, y, Z'' ) " "$←\;Z^t\; requis$"], "fontsize",3)
+isoview
+
+subplot(2,2,3)
+champ(x,y,sin(2*X'),cos(2*Y'))
+title(["champ(x, y, sin(X'' ),cos(Y'' ))" "$←\;X^t\;\;Y^t\; requis$"], "fontsize",3)
+isoview
+
+subplot(2,2,4)
 surf(X, Y, Z)
+title("surf(X, Y, Z)", "fontsize",3)
+isoview
+
+gcf().children.tight_limits = ["on" "on" "on"];
+drawnow
  ]]></programlisting>
+        <para/>
         <scilab:image>
-            x = -1:0.1:1;
-            [X,Y] = meshgrid(x);
-            Z = sinc(2*%pi*X.*Y);
+            // Generating data
+            x = -1:0.1:1.7;
+            y = -1:0.1:1;
+            [X, Y] = meshgrid(x, y);
+            Z = sinc(2*%pi * X.*Y);
+
+            // Setting the graphic figure
+            clf
+            drawlater
+            gcf().color_map = parulacolormap(64);
+            gcf().axes_size = [650 530];
+
+            // Plotting
+            subplot(2,2,1)
+            Sgrayplot(x, y, Z')
+            title(["Sgrayplot(x, y, Z'' ) " "$←\;Z^t\; required$"], "fontsize",3)
+            isoview, colorbar
+
+            subplot(2,2,2)
+            plot3d(x, y, Z', -125,50)
+            gce().color_flag = 1;
+            title(["plot3d(x, y, Z'' ) " "$←\;Z^t\; required$"], "fontsize",3)
+            isoview
+
+            subplot(2,2,3)
+            champ(x,y,sin(2*X'),cos(2*Y'))
+            title(["champ(x, y, sin(X'' ),cos(Y'' ))" "$←\;X^t\;\;Y^t\; required$"], "fontsize",3)
+            isoview
+
+            subplot(2,2,4)
             surf(X, Y, Z)
+            title("surf(X, Y, Z)", "fontsize",3)
+            isoview
+
+            gcf().children.tight_limits = ["on" "on" "on"];
+            drawnow
         </scilab:image>
     </refsection>
     <refsection role="see also">
@@ -60,6 +207,9 @@ surf(X, Y, Z)
                 <link linkend="ndgrid">ndgrid</link>
             </member>
             <member>
+                <link linkend="repmat">repmat</link>
+            </member>
+            <member>
                 <link linkend="feval">feval</link>
             </member>
         </simplelist>
diff --git a/scilab/modules/elementary_functions/help/ja_JP/elementarymatrices/meshgrid.xml b/scilab/modules/elementary_functions/help/ja_JP/elementarymatrices/meshgrid.xml
deleted file mode 100644 (file)
index 2c5efd5..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2008 - INRIA - Farid BELAHCENE
- *
- * Copyright (C) 2012 - 2016 - Scilab Enterprises
- *
- * This file is hereby licensed under the terms of the GNU GPL v2.0,
- * pursuant to article 5.3.4 of the CeCILL v.2.1.
- * This file was originally licensed under the terms of the CeCILL v2.1,
- * and continues to be available under such terms.
- * For more information, see the COPYING file which you should have received
- * along with this program.
- *
- -->
-
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
-          xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="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="meshgrid" xml:lang="ja">
-
-    <refnamediv>
-
-        <refname>meshgrid</refname>
-
-        <refpurpose>行列または3次元配列を作成</refpurpose>
-
-    </refnamediv>
-
-    <refsynopsisdiv>
-
-        <title>呼び出し手順</title>
-
-        <synopsis>[X, Y] = meshgrid(x)
-
-            [X, Y] = meshgrid(x,y)
-
-            [X, Y, Z] = meshgrid(x,y,z)
-
-        </synopsis>
-
-    </refsynopsisdiv>
-
-    <refsection>
-
-        <title>引数</title>
-
-        <variablelist>
-
-            <varlistentry>
-
-                <term>x, y, z</term>
-
-                <listitem>
-
-                    <para>ベクトル</para>
-
-                </listitem>
-
-            </varlistentry>
-
-            <varlistentry>
-
-                <term>X, Y, Z</term>
-
-                <listitem>
-
-                    <para>
-
-                        入力引数が2個の場合は行列,
-
-                        入力引数が3個の場合は3次元配列
-
-                    </para>
-
-                </listitem>
-
-            </varlistentry>
-
-        </variablelist>
-
-    </refsection>
-
-    <refsection>
-
-        <title>説明</title>
-
-        <para>行列または3次元配列を作成します.</para>
-
-    </refsection>
-
-    <refsection>
-
-        <title>例</title>
-
-        <programlisting role="example"><![CDATA[
-x = -1:0.1:1;
-[X, Y] = meshgrid(x);
-Z = sinc(2*%pi * X.*Y);
-surf(X, Y, Z)
-     ]]></programlisting>
-        <scilab:image>
-            x = -1:0.1:1;
-            [X,Y] = meshgrid(x);
-            Z = sinc(2*%pi*X.*Y);
-            surf(X, Y, Z)
-        </scilab:image>
-
-    </refsection>
-
-    <refsection role="see also">
-
-        <title>参照</title>
-
-        <simplelist type="inline">
-
-            <member>
-
-                <link linkend="ndgrid">ndgrid</link>
-
-            </member>
-            <member>
-                <link linkend="feval">feval</link>
-            </member>
-
-        </simplelist>
-
-    </refsection>
-
-</refentry>
-
index 8435af6..c1ad4eb 100644 (file)
@@ -2,8 +2,8 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA - Farid BELAHCENE
- *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2020 - Samuel GOUGEON
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
  * pursuant to article 5.3.4 of the CeCILL v.2.1.
           xmlns:scilab="http://www.scilab.org" xml:id="meshgrid" xml:lang="pt">
     <refnamediv>
         <refname>meshgrid</refname>
-        <refpurpose>cria matrizes ou arrays 3-D</refpurpose>
+        <refpurpose>
+            Cria matrizes ou arrays 3-D a partir de vetores replicados em 2 ou 3 dimensões
+        </refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Seqüência de Chamamento</title>
-        <synopsis>[X, Y] = meshgrid(x)
-            [X, Y] = meshgrid(x,y)
-            [X, Y, Z] = meshgrid(x,y,z)
+        <synopsis>
+            U = meshgrid(u)
+            [U, V] = meshgrid(u)
+            [X, Y] = meshgrid(x, y)
+            [X, Y, Z] = meshgrid(x, y, z)
         </synopsis>
     </refsynopsisdiv>
     <refsection>
         <title>Parâmetros</title>
         <variablelist>
             <varlistentry>
-                <term>x, y, z</term>
+                <term>u, x, y, z</term>
+                <listitem>
+                    Vetores de qualquer tipo, de comprimento nx, ny, nz.
+                    <para/>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>U, V</term>
                 <listitem>
-                    <para>vetores </para>
+                    Matrizes quadradas de tamanho nu x nu
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>X, Y, Z</term>
                 <listitem>
-                    <para>matrizes, no caso de dois argumentos de entrada, arrays 3-D,
-                        no caso de 3 argumentos de entrada.
-                    </para>
+                    Matrizes ou hipermatrizes do mesmo tamanho
+                    [<emphasis role="bold">ny</emphasis>, nx] ou
+                    [<emphasis role="bold">ny</emphasis>, nx, nz].
+                    <para/>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
     <refsection>
         <title>Descrição</title>
-        <para>...</para>
+        <para>
+            meshgrid (..) constrói matrizes ou matrizes 3D replicando vetores de entrada ao
+            longo de 2 ou 3 dimensões.
+        </para>
+        <para>
+            <note>
+                To create arrays of size [<emphasis role="bold">nx</emphasis>, ny] instead of
+                [ny, nx], or with more than 3 dimensions, please use
+                <literal>ndgrid(x, y)</literal> or <literal>ndgrid(x, y, z,..)</literal>.
+            </note>
+        </para>
+        <para>
+            <warning>
+                Most of Scilab 2D or 3D graphical functions like <literal>champ()</literal>,
+                <literal>grayplot()</literal>, <literal>Sgrayplot()</literal>,
+                <literal>plot3d()</literal>, <literal>contour()</literal>, etc.. work with grids
+                generated with <literal>ndgrid()</literal>, not from
+                <literal>meshgrid()</literal>. Data computed on grids coming from
+                <literal>meshgrid()</literal> will require being transposed (please see the
+                example thereafter).
+            </warning>
+        </para>
     </refsection>
     <refsection>
         <title>Exemplos</title>
         <programlisting role="example"><![CDATA[
-x = -1:0.1:1;
-[X, Y] = meshgrid(x);
+[X, Y] = meshgrid(0:2)
+ ]]></programlisting>
+    <screen>
+--> [X, Y] = meshgrid(0:2)
+ X  =
+   0.   1.   2.
+   0.   1.   2.
+   0.   1.   2.
+
+ Y  =
+   0.   0.   0.
+   1.   1.   1.
+   2.   2.   2.
+</screen>
+        <para/>
+        <programlisting role="example"><![CDATA[
+[X, Y] = meshgrid(["a" "bc" "αβγδ"], [-3 5])
+ ]]></programlisting>
+    <screen>
+--> [X, Y] = meshgrid(["a" "bc" "αβγδ"], [-3 5])
+ X  =
+!a  bc  αβγδ  !
+!a  bc  αβγδ  !
+
+ Y  =
+  -3.  -3.  -3.
+   5.   5.   5.
+</screen>
+        <para/>
+        <para>
+            Application to grids for graphics:
+        </para>
+        <programlisting role="example"><![CDATA[
+// Generating data
+x = -1:0.1:1.7;
+y = -1:0.1:1;
+[X, Y] = meshgrid(x, y);
 Z = sinc(2*%pi * X.*Y);
+
+// Setting the graphic figure
+clf
+drawlater
+gcf().color_map = parulacolormap(64);
+gcf().axes_size = [650 530];
+
+// Plotting
+subplot(2,2,1)
+Sgrayplot(x, y, Z')
+title(["Sgrayplot(x, y, Z'' ) " "$←\;Z^t\; required$"], "fontsize",3)
+isoview, colorbar
+
+subplot(2,2,2)
+plot3d(x, y, Z', -125,50)
+gce().color_flag = 1;
+title(["plot3d(x, y, Z'' ) " "$←\;Z^t\; required$"], "fontsize",3)
+isoview
+
+subplot(2,2,3)
+champ(x,y,sin(2*X'),cos(2*Y'))
+title(["champ(x, y, sin(X'' ),cos(Y'' ))" "$←\;X^t\;\;Y^t\; required$"], "fontsize",3)
+isoview
+
+subplot(2,2,4)
 surf(X, Y, Z)
-     ]]></programlisting>
+title("surf(X, Y, Z)", "fontsize",3)
+isoview
+
+gcf().children.tight_limits = ["on" "on" "on"];
+drawnow
+ ]]></programlisting>
+        <para/>
         <scilab:image>
-            x = -1:0.1:1;
-            [X,Y] = meshgrid(x);
-            Z = sinc(2*%pi*X.*Y);
+            // Generating data
+            x = -1:0.1:1.7;
+            y = -1:0.1:1;
+            [X, Y] = meshgrid(x, y);
+            Z = sinc(2*%pi * X.*Y);
+
+            // Setting the graphic figure
+            clf
+            drawlater
+            gcf().color_map = parulacolormap(64);
+            gcf().axes_size = [650 530];
+
+            // Plotting
+            subplot(2,2,1)
+            Sgrayplot(x, y, Z')
+            title(["Sgrayplot(x, y, Z'' ) " "$←\;Z^t\; required$"], "fontsize",3)
+            isoview, colorbar
+
+            subplot(2,2,2)
+            plot3d(x, y, Z', -125,50)
+            gce().color_flag = 1;
+            title(["plot3d(x, y, Z'' ) " "$←\;Z^t\; required$"], "fontsize",3)
+            isoview
+
+            subplot(2,2,3)
+            champ(x,y,sin(2*X'),cos(2*Y'))
+            title(["champ(x, y, sin(X'' ),cos(Y'' ))" "$←\;X^t\;\;Y^t\; required$"], "fontsize",3)
+            isoview
+
+            subplot(2,2,4)
             surf(X, Y, Z)
+            title("surf(X, Y, Z)", "fontsize",3)
+            isoview
+
+            gcf().children.tight_limits = ["on" "on" "on"];
+            drawnow
         </scilab:image>
     </refsection>
     <refsection role="see also">
@@ -73,6 +205,9 @@ surf(X, Y, Z)
                 <link linkend="ndgrid">ndgrid</link>
             </member>
             <member>
+                <link linkend="repmat">repmat</link>
+            </member>
+            <member>
                 <link linkend="feval">feval</link>
             </member>
         </simplelist>
index f8637c3..188af29 100644 (file)
@@ -2,8 +2,8 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA - Farid BELAHCENE
- *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2020 - Samuel GOUGEON
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
  * pursuant to article 5.3.4 of the CeCILL v.2.1.
     <refsynopsisdiv>
         <title>Синтаксис</title>
         <synopsis>
-            [X, Y] = meshgrid(x)
-            [X, Y] = meshgrid(x,y)
-            [X, Y, Z] = meshgrid(x,y,z)
+            U = meshgrid(u)
+            [U, V] = meshgrid(u)
+            [X, Y] = meshgrid(x, y)
+            [X, Y, Z] = meshgrid(x, y, z)
         </synopsis>
     </refsynopsisdiv>
     <refsection>
         <title>Аргументы</title>
         <variablelist>
             <varlistentry>
-                <term>x, y, z</term>
+                <term>u, x, y, z</term>
+                <listitem>
+                    vectors of any types, of lengths nu, nx, ny, nz.
+                    <para/>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>U, V</term>
                 <listitem>
-                    <para>векторы</para>
+                    Square matrices of size nu x nu
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>X, Y, Z</term>
                 <listitem>
-                    <para>
-                        матрицы, если два входных аргумента, а если входных аргументов три, то трёхмерные массивы
-                    </para>
+                    Matrices or hypermatrices of the same size
+                    [<emphasis role="bold">ny</emphasis>, nx] or
+                    [<emphasis role="bold">ny</emphasis>, nx, nz].
+                    <para/>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
     <refsection>
         <title>Описание</title>
-        <para>Создаёт матрицы или трёхмерные массивы.</para>
+        <para>
+            meshgrid(..) builds matrices or 3-D hypermatrices by replicating input vectors
+            along 2 or 3 dimensions.
+        </para>
+        <para>
+            <note>
+                To create arrays of size [<emphasis role="bold">nx</emphasis>, ny] instead of
+                [ny, nx], or with more than 3 dimensions, please use
+                <literal>ndgrid(x, y)</literal> or <literal>ndgrid(x, y, z,..)</literal>.
+            </note>
+        </para>
+        <para>
+            <warning>
+                Most of Scilab 2D or 3D graphical functions like <literal>champ()</literal>,
+                <literal>grayplot()</literal>, <literal>Sgrayplot()</literal>,
+                <literal>plot3d()</literal>, <literal>contour()</literal>, etc.. work with grids
+                generated with <literal>ndgrid()</literal>, not from
+                <literal>meshgrid()</literal>. Data computed on grids coming from
+                <literal>meshgrid()</literal> will require being transposed (please see the
+                example thereafter).
+            </warning>
+        </para>
     </refsection>
     <refsection>
         <title>Примеры</title>
         <programlisting role="example"><![CDATA[
-x = -1:0.1:1;
-[X, Y] = meshgrid(x);
+[X, Y] = meshgrid(0:2)
+ ]]></programlisting>
+    <screen>
+--> [X, Y] = meshgrid(0:2)
+ X  =
+   0.   1.   2.
+   0.   1.   2.
+   0.   1.   2.
+
+ Y  =
+   0.   0.   0.
+   1.   1.   1.
+   2.   2.   2.
+</screen>
+        <para/>
+        <programlisting role="example"><![CDATA[
+[X, Y] = meshgrid(["a" "bc" "αβγδ"], [-3 5])
+ ]]></programlisting>
+    <screen>
+--> [X, Y] = meshgrid(["a" "bc" "αβγδ"], [-3 5])
+ X  =
+!a  bc  αβγδ  !
+!a  bc  αβγδ  !
+
+ Y  =
+  -3.  -3.  -3.
+   5.   5.   5.
+</screen>
+        <para/>
+        <para>
+            Application to grids for graphics:
+        </para>
+        <programlisting role="example"><![CDATA[
+// Generating data
+x = -1:0.1:1.7;
+y = -1:0.1:1;
+[X, Y] = meshgrid(x, y);
 Z = sinc(2*%pi * X.*Y);
+
+// Setting the graphic figure
+clf
+drawlater
+gcf().color_map = parulacolormap(64);
+gcf().axes_size = [650 530];
+
+// Plotting
+subplot(2,2,1)
+Sgrayplot(x, y, Z')
+title(["Sgrayplot(x, y, Z'' ) " "$←\;Z^t\; required$"], "fontsize",3)
+isoview, colorbar
+
+subplot(2,2,2)
+plot3d(x, y, Z', -125,50)
+gce().color_flag = 1;
+title(["plot3d(x, y, Z'' ) " "$←\;Z^t\; required$"], "fontsize",3)
+isoview
+
+subplot(2,2,3)
+champ(x,y,sin(2*X'),cos(2*Y'))
+title(["champ(x, y, sin(X'' ),cos(Y'' ))" "$←\;X^t\;\;Y^t\; required$"], "fontsize",3)
+isoview
+
+subplot(2,2,4)
 surf(X, Y, Z)
-     ]]></programlisting>
+title("surf(X, Y, Z)", "fontsize",3)
+isoview
+
+gcf().children.tight_limits = ["on" "on" "on"];
+drawnow
+ ]]></programlisting>
+        <para/>
         <scilab:image>
-            x = -1:0.1:1;
-            [X,Y] = meshgrid(x);
-            Z = sinc(2*%pi*X.*Y);
+            // Generating data
+            x = -1:0.1:1.7;
+            y = -1:0.1:1;
+            [X, Y] = meshgrid(x, y);
+            Z = sinc(2*%pi * X.*Y);
+
+            // Setting the graphic figure
+            clf
+            drawlater
+            gcf().color_map = parulacolormap(64);
+            gcf().axes_size = [650 530];
+
+            // Plotting
+            subplot(2,2,1)
+            Sgrayplot(x, y, Z')
+            title(["Sgrayplot(x, y, Z'' ) " "$←\;Z^t\; required$"], "fontsize",3)
+            isoview, colorbar
+
+            subplot(2,2,2)
+            plot3d(x, y, Z', -125,50)
+            gce().color_flag = 1;
+            title(["plot3d(x, y, Z'' ) " "$←\;Z^t\; required$"], "fontsize",3)
+            isoview
+
+            subplot(2,2,3)
+            champ(x,y,sin(2*X'),cos(2*Y'))
+            title(["champ(x, y, sin(X'' ),cos(Y'' ))" "$←\;X^t\;\;Y^t\; required$"], "fontsize",3)
+            isoview
+
+            subplot(2,2,4)
             surf(X, Y, Z)
+            title("surf(X, Y, Z)", "fontsize",3)
+            isoview
+
+            gcf().children.tight_limits = ["on" "on" "on"];
+            drawnow
         </scilab:image>
     </refsection>
     <refsection role="see also">
@@ -74,6 +203,9 @@ surf(X, Y, Z)
                 <link linkend="ndgrid">ndgrid</link>
             </member>
             <member>
+                <link linkend="repmat">repmat</link>
+            </member>
+            <member>
                 <link linkend="feval">feval</link>
             </member>
         </simplelist>
index 69d4cb8..8b93df1 100644 (file)
@@ -845,7 +845,7 @@ math_rendering_features_in_graphic_2.png=c93a1a79cbe217871185826f83fdd7bb
 mese_1.png=c4ce712eded4fbbd49bb86b02e14afe9\r
 mesh2d_1.png=1fa605c61245e3610f300101926fa60f\r
 mesh_1.png=a17150f02dbe853486f73801c9afcd11\r
-meshgrid_1.png=9568cd9a7f4be8fde70668a8c5fbfd28\r
+meshgrid_1.png=c7dfaf642b8123d96d5131426eef0ca6\r
 move_1.png=c4599a8693c9c099ac9c7f1a5dee3e91\r
 mrfit_1.png=d8d3736f01fc8fc707c53508cddd575f\r
 nanreglin_1.png=a2189dd0a4084c54b9c1e05b45db555b\r
index 000ff63..4cc24f1 100644 (file)
Binary files a/scilab/modules/helptools/images/meshgrid_1.png and b/scilab/modules/helptools/images/meshgrid_1.png differ