如何在 Matlab 中绘制 3D 网格(立方体) [英] How to plot 3D grid (cube) in Matlab
本文介绍了如何在 Matlab 中绘制 3D 网格(立方体)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想绘制带有线条的透明立方体网格.像这样的东西:
Hi I would like to plot transparent cube-shaped grid with lines in it. Something like this:
然而,我只设法绘制了一个 2D 网格:
However, I managed only to draw a 2D grid:
[X,Y] = meshgrid(-8:.5:8);
Z = X+1;
surf(X,Y,Z)
我使用的是 Matlab R2009b.如果无法在 matlab 中绘制此图,您能否向我推荐一个我可以使用的软件.
I use Matlab R2009b. If it is impossible to plot this in matlab could you recommend me a software I could use.
推荐答案
如果你不介意一些 for 循环,这样的事情会奏效:
If you don't mind a few for loops, something like this will work:
clf
figure(1)
for g = 0:.2:2
for i = 0:.2:2
plot3([g g], [0 2], [i, i])
hold on
end
end
for g = 0:.2:2
for i = 0:.2:2
plot3([0 2], [g g], [i, i])
hold on
end
end
for g = 0:.2:2
for i = 0:.2:2
plot3([i i], [g g], [0 2])
hold on
end
end
您可能只需要通过更改线条属性来使网格透明,我认为您无法更改 alpha 值来实现此目的.希望有帮助.
You will just need to make the grid transparent by probably changing line properties, I don't think you can change alpha values to accomplish this. Hope that is helpful.
这篇关于如何在 Matlab 中绘制 3D 网格(立方体)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文