|MATLAB Function Reference|
Y matrices for three-dimensional plots
[X,Y] = meshgrid(x,y)
transforms the domain specified by vectors
y into arrays
Y, which can be used to evaluate functions of two variables and three-dimensional mesh/surface plots. The rows of the output array
X are copies of the vector
x; columns of the output array
Y are copies of the vector
[X,Y] = meshgrid(x)
is the same as
[X,Y] = meshgrid(x,x).
[X,Y,Z] = meshgrid(x,y,z)
produces three-dimensional arrays used to evaluate functions of three variables and three-dimensional volumetric plots.
meshgrid function is similar to
ndgrid except that the order of the first two input and output arguments is switched. That is, the statement
produces the same result as
Because of this,
meshgrid is better suited to problems in two- or three-dimensional Cartesian space, while
ndgrid is better suited to multidimensional problems that aren't spatially based.
meshgrid is limited to two- or three-dimensional Cartesian space.
|mesh, meshc, meshz||methods|