Ymatrices for 3-D plots.
[X,Y] = meshgrid(x,y)[X,Y] = meshgrid(x)
[X,Y] = meshgrid(x,y)transforms the domain specified by vectors
Ythat can be used for the evaluation of functions of two variables and three-dimensional mesh/surface plots. The rows of the output matrix
Xare copies of the vector
xand the columns of the output matrix
Yare copies of the vector
[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))])
(c) Copyright 1994 by The MathWorks, Inc.