plot a partial sphere with a circular top like a bowl

6 ビュー (過去 30 日間)
monarch
monarch 2017 年 12 月 2 日
編集済み: monarch 2017 年 12 月 2 日
I'd like to plot a partial sphere (like a bowl) where the radius from the centroid to the edge is .1385 and the radius of the mouth of the bowl is .0525.
I have this but I couldn't figure out how to cut off the square-ish top to only show the bowl-like shape
R = .1385;
[X,Y] = meshgrid(-.07:.001:.07);
Z = sqrt(R.^2 + X.^2 + Y.^2);
Z(imag(Z) ~= 0) =0;
mesh(X,Y,Z);

採用された回答

Akira Agata
Akira Agata 2017 年 12 月 2 日
I think one possible solution would be fsurf function. How about the following script?
R = 0.1385;
r1 = 0.0525;
theta = asin(r1/R);
funx = @(u,v) R*cos(u).*sin(v);
funy = @(u,v) R*sin(u).*sin(v);
funz = @(u,v) -R*cos(v);
fsurf(funx,funy,funz,[0 2*pi 0 theta])
  2 件のコメント
monarch
monarch 2017 年 12 月 2 日
Brilliant - thanks! and if I add to keep the units on the axes the same
daspect([1 1 1])
it looks like it's supposed to look!!!
monarch
monarch 2017 年 12 月 2 日
編集済み: monarch 2017 年 12 月 2 日
Another question: If I'm plotting several of these with different values of R, but I'd like the color to be the same across different plots for a given value on the z axis, how might I do that?

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

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