* Bug 7967 fixed [doc]: size(meshgrid(..)) better documented
[scilab.git] / scilab / modules / elementary_functions / help / pt_BR / elementarymatrices / meshgrid.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) 2008 - INRIA - Farid BELAHCENE
5  * Copyright (C) 2012 - 2016 - Scilab Enterprises
6  * Copyright (C) 2020 - Samuel GOUGEON
7  *
8  * This file is hereby licensed under the terms of the GNU GPL v2.0,
9  * pursuant to article 5.3.4 of the CeCILL v.2.1.
10  * This file was originally licensed under the terms of the CeCILL v2.1,
11  * and continues to be available under such terms.
12  * For more information, see the COPYING file which you should have received
13  * along with this program.
14  *
15  -->
16 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17           xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml"
18           xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook"
19           xmlns:scilab="http://www.scilab.org" xml:id="meshgrid" xml:lang="pt">
20     <refnamediv>
21         <refname>meshgrid</refname>
22         <refpurpose>
23             Cria matrizes ou arrays 3-D a partir de vetores replicados em 2 ou 3 dimensões
24         </refpurpose>
25     </refnamediv>
26     <refsynopsisdiv>
27         <title>Seqüência de Chamamento</title>
28         <synopsis>
29             U = meshgrid(u)
30             [U, V] = meshgrid(u)
31             [X, Y] = meshgrid(x, y)
32             [X, Y, Z] = meshgrid(x, y, z)
33         </synopsis>
34     </refsynopsisdiv>
35     <refsection>
36         <title>Parâmetros</title>
37         <variablelist>
38             <varlistentry>
39                 <term>u, x, y, z</term>
40                 <listitem>
41                     Vetores de qualquer tipo, de comprimento nx, ny, nz.
42                     <para/>
43                 </listitem>
44             </varlistentry>
45             <varlistentry>
46                 <term>U, V</term>
47                 <listitem>
48                     Matrizes quadradas de tamanho nu x nu
49                     <para/>
50                 </listitem>
51             </varlistentry>
52             <varlistentry>
53                 <term>X, Y, Z</term>
54                 <listitem>
55                     Matrizes ou hipermatrizes do mesmo tamanho
56                     [<emphasis role="bold">ny</emphasis>, nx] ou
57                     [<emphasis role="bold">ny</emphasis>, nx, nz].
58                     <para/>
59                 </listitem>
60             </varlistentry>
61         </variablelist>
62     </refsection>
63     <refsection>
64         <title>Descrição</title>
65         <para>
66             meshgrid (..) constrói matrizes ou matrizes 3D replicando vetores de entrada ao
67             longo de 2 ou 3 dimensões.
68         </para>
69         <para>
70             <note>
71                 To create arrays of size [<emphasis role="bold">nx</emphasis>, ny] instead of
72                 [ny, nx], or with more than 3 dimensions, please use
73                 <literal>ndgrid(x, y)</literal> or <literal>ndgrid(x, y, z,..)</literal>.
74             </note>
75         </para>
76         <para>
77             <warning>
78                 Most of Scilab 2D or 3D graphical functions like <literal>champ()</literal>,
79                 <literal>grayplot()</literal>, <literal>Sgrayplot()</literal>,
80                 <literal>plot3d()</literal>, <literal>contour()</literal>, etc.. work with grids
81                 generated with <literal>ndgrid()</literal>, not from
82                 <literal>meshgrid()</literal>. Data computed on grids coming from
83                 <literal>meshgrid()</literal> will require being transposed (please see the
84                 example thereafter).
85             </warning>
86         </para>
87     </refsection>
88     <refsection>
89         <title>Exemplos</title>
90         <programlisting role="example"><![CDATA[
91 [X, Y] = meshgrid(0:2)
92  ]]></programlisting>
93     <screen>
94 --> [X, Y] = meshgrid(0:2)
95  X  =
96    0.   1.   2.
97    0.   1.   2.
98    0.   1.   2.
99
100  Y  =
101    0.   0.   0.
102    1.   1.   1.
103    2.   2.   2.
104 </screen>
105         <para/>
106         <programlisting role="example"><![CDATA[
107 [X, Y] = meshgrid(["a" "bc" "αβγδ"], [-3 5])
108  ]]></programlisting>
109     <screen>
110 --> [X, Y] = meshgrid(["a" "bc" "αβγδ"], [-3 5])
111  X  =
112 !a  bc  αβγδ  !
113 !a  bc  αβγδ  !
114
115  Y  =
116   -3.  -3.  -3.
117    5.   5.   5.
118 </screen>
119         <para/>
120         <para>
121             Application to grids for graphics:
122         </para>
123         <programlisting role="example"><![CDATA[
124 // Generating data
125 x = -1:0.1:1.7;
126 y = -1:0.1:1;
127 [X, Y] = meshgrid(x, y);
128 Z = sinc(2*%pi * X.*Y);
129
130 // Setting the graphic figure
131 clf
132 drawlater
133 gcf().color_map = parulacolormap(64);
134 gcf().axes_size = [650 530];
135
136 // Plotting
137 subplot(2,2,1)
138 Sgrayplot(x, y, Z')
139 title(["Sgrayplot(x, y, Z'' ) " "$←\;Z^t\; required$"], "fontsize",3)
140 isoview, colorbar
141
142 subplot(2,2,2)
143 plot3d(x, y, Z', -125,50)
144 gce().color_flag = 1;
145 title(["plot3d(x, y, Z'' ) " "$←\;Z^t\; required$"], "fontsize",3)
146 isoview
147
148 subplot(2,2,3)
149 champ(x,y,sin(2*X'),cos(2*Y'))
150 title(["champ(x, y, sin(X'' ),cos(Y'' ))" "$←\;X^t\;\;Y^t\; required$"], "fontsize",3)
151 isoview
152
153 subplot(2,2,4)
154 surf(X, Y, Z)
155 title("surf(X, Y, Z)", "fontsize",3)
156 isoview
157
158 gcf().children.tight_limits = ["on" "on" "on"];
159 drawnow
160  ]]></programlisting>
161         <para/>
162         <scilab:image>
163             // Generating data
164             x = -1:0.1:1.7;
165             y = -1:0.1:1;
166             [X, Y] = meshgrid(x, y);
167             Z = sinc(2*%pi * X.*Y);
168
169             // Setting the graphic figure
170             clf
171             drawlater
172             gcf().color_map = parulacolormap(64);
173             gcf().axes_size = [650 530];
174
175             // Plotting
176             subplot(2,2,1)
177             Sgrayplot(x, y, Z')
178             title(["Sgrayplot(x, y, Z'' ) " "$←\;Z^t\; required$"], "fontsize",3)
179             isoview, colorbar
180
181             subplot(2,2,2)
182             plot3d(x, y, Z', -125,50)
183             gce().color_flag = 1;
184             title(["plot3d(x, y, Z'' ) " "$←\;Z^t\; required$"], "fontsize",3)
185             isoview
186
187             subplot(2,2,3)
188             champ(x,y,sin(2*X'),cos(2*Y'))
189             title(["champ(x, y, sin(X'' ),cos(Y'' ))" "$←\;X^t\;\;Y^t\; required$"], "fontsize",3)
190             isoview
191
192             subplot(2,2,4)
193             surf(X, Y, Z)
194             title("surf(X, Y, Z)", "fontsize",3)
195             isoview
196
197             gcf().children.tight_limits = ["on" "on" "on"];
198             drawnow
199         </scilab:image>
200     </refsection>
201     <refsection role="see also">
202         <title>Ver Também</title>
203         <simplelist type="inline">
204             <member>
205                 <link linkend="ndgrid">ndgrid</link>
206             </member>
207             <member>
208                 <link linkend="repmat">repmat</link>
209             </member>
210             <member>
211                 <link linkend="feval">feval</link>
212             </member>
213         </simplelist>
214     </refsection>
215 </refentry>