How can I create this image?

1 回表示 (過去 30 日間)
Mara Pereira
Mara Pereira 2020 年 5 月 22 日
回答済み: Star Strider 2020 年 5 月 22 日
  1 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 5 月 22 日
It is much easier to create these objects in a 3D graphics modeling tool, such as blender: https://www.blender.org/, export the mesh as STL file, and then use stlread(): https://www.mathworks.com/help/releases/R2020a/matlab/ref/stlread.html to load it in MATLAB. It is certainly possible to create these shapes in MATLAB using patches and surfaces but that the solution can become complicated, and it cannot be applied to each general shape. For each shape, you will need to use a different technique.

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

採用された回答

Star Strider
Star Strider 2020 年 5 月 22 日
Try this:
[X1,Y1,Z1] = cylinder;
X2 = bsxfun(@times, X1, [1.2; 0]);
Y2 = bsxfun(@times, Y1, [1.2; 0]);
figure
Ax = gca;
surf(X1, Y1, Z1, 'FaceAlpha', 0.5)
hold on
surf(X2, Y2, Z1+max(Z1(:)), 'FaceAlpha', 0.5)
hold off
Ax.Color = [1 1 1]*0.7;
Ax.GridLineStyle = 'none';
Ax.XAxis.Color = 'none';
Ax.YAxis.Color = 'none';
Ax.ZAxis.Color = 'none';
view(-40,20)
Experiment to get the result you want.

その他の回答 (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