Two or more 3D volumes on same axis .

4 ビュー (過去 30 日間)
yogesh jain
yogesh jain 2015 年 10 月 22 日
コメント済み: Star Strider 2015 年 10 月 23 日
Hello all , I want to ask that, is there any way to plot two or more 3D volumes on same axis ? or say merging of two or more different 3D volumes on same axis having different graphical properties . like cube with sphere or cylinder with cube or cone with sphere etc.

採用された回答

Star Strider
Star Strider 2015 年 10 月 22 日
Yes!
r = 0:0.05:0.5;
[xc,yc,zc] = cylinder(r);
[xs,yx,zs] = sphere;
figure(1)
surf(xc,yc,zc)
hold on
surf(xs*0.5,yx*0.5,zs*0.5+1.1)
hold off
grid on
axis equal
  2 件のコメント
yogesh jain
yogesh jain 2015 年 10 月 23 日
Thanks a lot sir , But if I want both shapes in intersecting manner , then ?
Star Strider
Star Strider 2015 年 10 月 23 日
My pleasure.
They are intersecting here, to an extent. If you want the cone to be cutting through the sphere, do something like this:
figure(1)
surf(xc,yc,zc)
hold on
surf(xs*0.5,yx*0.5,zs*0.5+0.2)
hold off
grid on
axis equal
Note that here the sphere z-offset is 0.2 rather than 1.1 as in the original plot.
Experiment with them to get the result you want. Also, see the documentation for the sphere and cylinder functions.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by