X
and Y
matrices for 3-D plots.
[X,Y] = meshgrid(x,y)
[X,Y] = meshgrid(x)
[X,Y] = meshgrid(x,y)
transforms the domain specified by vectors x
and y
into matrices X
and Y
that can be used for the evaluation of functions of two variables and three-dimensional mesh/surface plots. The rows of the output matrix X
are copies of the vector x
and the columns of the output matrix Y
are copies of the vector y
.
[X,Y] = meshgrid(x)
is an abbreviation of [X,Y] = meshgrid(x,x)
.
over the range -2 <= x <= 2, -2 <= y <= 2,
[X,Y] = meshgrid(-2:.2:2);
Z = X.
*exp(-X.^2 - Y.^2);
mesh(Z) axis([0 20 0 20 min(min(Z)) max(max(Z))])
griddata,mesh
,surf
(c) Copyright 1994 by The MathWorks, Inc.