如何在Matlab中绘制三维网格(立方体) [英] How to plot 3D grid (cube) in Matlab
本文介绍了如何在Matlab中绘制三维网格(立方体)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想绘制透明的立方体形网格线。像这样:
然而,我只管理了一个2D网格:
[X,Y] = meshgrid(-8 :. 5:8);
Z = X + 1;
surf(X,Y,Z)
我使用Matlab R2009b。
如果在matlab中不可能绘制这个图像,你可以推荐我使用一个软件。
clf
图(1)
for g = 0:.2:2
for i = 0:.2:2
plot3([gg],[0 2],[i,i])
持有
结束
结束
g = 0:0.2:2
i = 0:0.2:2
$对于g = 0,b $ b plot3([0 2],[gg],[i,i])
持有
结束
结束
。 2:2
对于i = 0:.2:2
plot3([ii],[gg],[0 2])
保持
结束
end
您只需要通过更改线条属性来使网格透明,I不要以为你可以改变alpha值来完成这个。希望有帮助。
Hi I would like to plot transparent cube-shaped grid with lines in it. Something like this:
However, I managed only to draw a 2D grid:
[X,Y] = meshgrid(-8:.5:8);
Z = X+1;
surf(X,Y,Z)
I use Matlab R2009b. If it is impossible to plot this in matlab could you recommend me a software I could use.
解决方案
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
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中绘制三维网格(立方体)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文