如何在matlab中用给定的点绘制3d图,并将它们连接起来?
我有几个点,我想画它们,然后用线连接它们,我尝试过:
plot3(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4)
依此类推,最多大约 100 个,但我只是得到很多点的图,如何用线连接它们?
I've got few points and I wanted to draw them, and join them with line, I tried:
plot3(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4)
and so on up to about 100, but Im just getting plot with many points, how to join them with line?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您现在正在做的是告诉 MATLAB 分别绘制每个点。您应该做的是将所有点存储为向量,然后使用plot3。例如,
这样你就可以得到一条连接你的点的线。
What you're doing right now is telling MATLAB to plot each point separately. What you should do is to store all your points as a vector and then use
plot3
. E.g.,This way you get a line joining your points.
还有另一种可能性是使用名为
line
的低级函数。通过上面的示例,您的代码将如下所示:There is another possibility which is using the low level function called
line
. By taking the above example, your code would look like this: