为什么我在 MATLAB 切片图中丢失了一行和一列?
Why am I loosing a row and a column in MATLAB slice plot?
我正在尝试在 MATLAB 中绘制 3D 体积。我正在使用切片命令。
a(:,:,1)=[1,2; 3,4];
a(:,:,2)=[5,6; 9,8];
figure;
slice (a,0,0,1);
hold on
slice (a,0,0,2);
我得到的图形只有一个正方形(像素)。我期待 4 个方格。我如何绘制这个?我究竟做错了什么?
documentation的相关部分:
slice(V,sx,sy,sz) draws slices along the x, y, z directions in the volume V at the points in the vectors sx, sy, and sz. V is an m-by-n-by-p volume array containing data values at the default location X = 1:n, Y = 1:m, Z = 1:p. Each element in the vectors sx, sy, and sz defines a slice plane in the x-, y-, or z-axis direction.
因此,您的命令 slice (a,0,0,1);
要求 Matlab 生成 三个 立方体切片 [1,2]×[1,2]×[1,2 ](根据 a
数组的值着色),由以下平面
- x=0 平面(显示为空方块,因为它在立方体之外)
- y=0 平面(同一个故事)
- z=1 平面(深蓝色方块)。
您可以使用 slice(a,[],[],1)
避免无关的 x=0 和 y=0 切片。另外,
slice(a,[],[],[1,2])
会给你顶部和底部
slice(a,[],[1,2],[])
会给出两个垂直边
slice(a,[1,2],[],[])
会给出另外两个垂直边
或者您可以使用 slice(a,[1,2],[1,2],[1,2])
一次获得所有六个。如果您不想要,例如顶部和底部切片,则 slice(a,[1,2],[1,2],[])
.
注意a
的条目不是坐标,它们被理解为三变量函数的值,并用颜色表示。
我正在尝试在 MATLAB 中绘制 3D 体积。我正在使用切片命令。
a(:,:,1)=[1,2; 3,4];
a(:,:,2)=[5,6; 9,8];
figure;
slice (a,0,0,1);
hold on
slice (a,0,0,2);
我得到的图形只有一个正方形(像素)。我期待 4 个方格。我如何绘制这个?我究竟做错了什么?
documentation的相关部分:
slice(V,sx,sy,sz) draws slices along the x, y, z directions in the volume V at the points in the vectors sx, sy, and sz. V is an m-by-n-by-p volume array containing data values at the default location X = 1:n, Y = 1:m, Z = 1:p. Each element in the vectors sx, sy, and sz defines a slice plane in the x-, y-, or z-axis direction.
因此,您的命令 slice (a,0,0,1);
要求 Matlab 生成 三个 立方体切片 [1,2]×[1,2]×[1,2 ](根据 a
数组的值着色),由以下平面
- x=0 平面(显示为空方块,因为它在立方体之外)
- y=0 平面(同一个故事)
- z=1 平面(深蓝色方块)。
您可以使用 slice(a,[],[],1)
避免无关的 x=0 和 y=0 切片。另外,
slice(a,[],[],[1,2])
会给你顶部和底部slice(a,[],[1,2],[])
会给出两个垂直边slice(a,[1,2],[],[])
会给出另外两个垂直边
或者您可以使用 slice(a,[1,2],[1,2],[1,2])
一次获得所有六个。如果您不想要,例如顶部和底部切片,则 slice(a,[1,2],[1,2],[])
.
注意a
的条目不是坐标,它们被理解为三变量函数的值,并用颜色表示。