Professional Documents
Culture Documents
Meshgrid: Rectangular Grid in 2-D and 3-D Space
Meshgrid: Rectangular Grid in 2-D and 3-D Space
Syntax
[X,Y] = meshgrid(xgv,ygv)
[X,Y,Z] = meshgrid(xgv,ygv,zgv)
[X,Y] = meshgrid(gv)
[X,Y,Z] = meshgrid(gv)
Description
replicates the grid vectors xgv and ygv to produce a full grid.
This grid is represented by the output coordinate arrays X and Y. The output coordinate
arrays X and Ycontain copies of the grid vectors xgv and ygv respectively. The sizes of the
output arrays are determined by the length of the grid vectors. For grid
vectors xgv and ygv of length M and Nrespectively, X and Y will have N rows
and M columns.
[X,Y] = meshgrid(xgv,ygv)
The output coordinate arrays are typically used to evaluate functions of two or three
variables. They are also frequently used to create surface and volumetric plots.
Input Arguments
xgv,ygv,zgv
gv
Output Arguments
X,Y,Z
Examples
2-D Grid From Vectors
[X,Y] = meshgrid(1:3,10:14)
X=
1
Y=
10
10
10
11
11
11
12
12
12
13
13
13
14
14
14
(X,Y) domain.
More About