How can I truncate a prolate spheroid?

1 回表示 (過去 30 日間)
Nicholas
Nicholas 2014 年 8 月 4 日
コメント済み: Nicholas 2014 年 8 月 4 日
I first generated a prolate spheroid through:
[x y z] = sphere;
x = x;
y = y;
z = 2*z;
surf(x,y,z), axis equal
I need to truncate the prolate spheroid at one end. What is a simple way of doing this?
Cheers,
Nic

採用された回答

Image Analyst
Image Analyst 2014 年 8 月 4 日
Try using logical indexing to set the top flat:
[x y z] = sphere(100);
x = x;
y = y;
z = 2*z;
highZ = z > 1;
x(highZ) = 0;
y(highZ) = 0;
z(highZ) = 1;
surf(x,y,z);
axis equal
  1 件のコメント
Nicholas
Nicholas 2014 年 8 月 4 日
Thanks very much - a simple and effective solution.
Cheers
Nic

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

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by