大家好,又见面了,我是你们的朋友全栈君。
函数参数列表
[X,Y] = meshgrid(x,y) [X,Y] = meshgrid(x) [X,Y,Z] = meshgrid(x,y,z) [X,Y,Z] = meshgrid(x)
meshgrid可以生成2D或者3D的矩阵,
如果为2D,矩阵的shape为(y.length, x.length) 如果为3D,矩阵的shape为(y.length, x.length,z.length)
而内容呢,X由x来填充,Y由y来填充,Z由z来填充
代码示例
sample1
代码语言:javascript复制x=1:2; %length 2
y=3:5; %length 3
[X,Y]=meshgrid(x,y);
disp(X);
disp(Y);
sample2
代码语言:javascript复制x=1:4; %length 4
y=3:5; %length 3
z=1:2; %length 2
[X,Y,Z]=meshgrid(x,y,z);
disp("X=");
disp(X);
disp("Y=");
disp(Y);
disp("Z=");
disp(Z);
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/139565.html原文链接:https://javaforall.cn