0

我想在 Matlab 中连接具有相同 Z 值的 3d 散点图中的点。

num=1e2;
x=rand(num,1);
y=rand(num,1);
z=zeros(num,1);
z(randsample(num,.25*num),:)=1;
scatter3(x,y,z);hold on;scatter3(x1,y1,z1);hold on;
%connect dots with same Z value, so there should be horizontal line between points in the same Z plane
4

1 回答 1

0

当你说“连接点”时,我不确定你在想什么,但这里有一个方向:

figure, hold on
for u = unique(z(:))'
    plot3(x(z == u), y(z == u), z(z == u))
end
view(-37.5, 30)

或者,也许您可​​以修改数据并改用该contour3命令。

于 2013-01-29T15:08:10.780 回答