返回信息流meshgrid(-3:.125:3)中后面括号里的格式代表什么意思?
这是一条镜像帖。来源:北邮人论坛 / math-model / #9343同步于 2012/8/18
该镜像源已超过 30 天没有更新,可能在源站已被删除。
MathModel机器人发帖
菜鸟matlab问题
fbr1992
2012/8/18镜像同步3 回复
订阅后,新回复会通过你的通知中心匿名送达。
3 条回复
做三维网格图时的网格一边的范围,-3到3,每格距离0.125
meshgrid Cartesian grid in 2-D/3-D space
[X,Y] = meshgrid(xgv,ygv) replicates the grid vectors xgv and ygv to
produce the coordinates of a rectangular grid (X, Y). The grid vector
xgv is replicated numel(ygv) times to form the columns of X. The grid
vector ygv is replicated numel(xgv) times to form the rows of Y.
[X,Y,Z] = meshgrid(xgv,ygv,zgv) replicates the grid vectors xgv, ygv, zgv
to produce the coordinates of a 3D rectangular grid (X, Y, Z). The grid
vectors xgv,ygv,zgv form the columns of X, rows of Y, and pages of Z
respectively. (X,Y,Z) are of size numel(ygv)-by-numel(xgv)-by(numel(zgv).
[X,Y] = meshgrid(gv) is equivalent to [X,Y] = meshgrid(gv,gv).
[X,Y,Z] = meshgrid(gv) is equivalent to [X,Y,Z] = meshgrid(gv,gv,gv).
The coordinate arrays are typically used for the evaluation of functions
of two or three variables and for surface and volumetric plots.
meshgrid and NDGRID are similar, though meshgrid is restricted to 2-D
and 3-D while NDGRID supports 1-D to N-D. In 2-D and 3-D the coordinates
output by each function are the same, the difference is the shape of the
output arrays. For grid vectors xgv, ygv and zgv of length M, N and P
respectively, NDGRID(xgv, ygv) will output arrays of size M-by-N while
meshgrid(xgv, ygv) outputs arrays of size N-by-M. Similarly,
NDGRID(xgv, ygv, zgv) will output arrays of size M-by-N-by-P while
meshgrid(xgv, ygv, zgv) outputs arrays of size N-by-M-by-P.
Example: Evaluate the function x*exp(-x^2-y^2)
over the range -2 < x < 2, -4 < y < 4,
[X,Y] = meshgrid(-2:.2:2, -4:.4:4);
Z = X .* exp(-X.^2 - Y.^2);
surf(X,Y,Z)
这里如果x,y相同,可以简写成一个
多谢!
【 在 jellyray 的大作中提到: 】
: 做三维网格图时的网格一边的范围,-3到3,每格距离0.125
: meshgrid Cartesian grid in 2-D/3-D space
: [X,Y] = meshgrid(xgv,ygv) replicates the grid vectors xgv and ygv to
: ...................