Plot the part of the cylinder x^2 + z^2 = 1 for y ≥ 0 , 0 ≤ z ≤ − y^2 + 1 . Can someone help me

10 次查看(过去 30 天)
i don't know how to do it

回答(1 个)

DGM
DGM 2021-5-11
This is a rather simple approach:
n = 200;
th = linspace(0,pi,n);
x = linspace(-1,1,n);
y = linspace(0,1,n).';
zc = repmat(sin(th),[n 1]);
xc = cos(th);
zp = repmat(-y.^2+1,[1 n]);
zc(zc>zp) = NaN;
surf(xc,y,zc); hold on
shading flat
axis equal
If you want to be assured that the trimmed face follows a parabola:
n = 200;
th = linspace(0,pi,n);
x = linspace(-1,1,n);
y = linspace(0,1,n).';
zc = repmat(sin(th),[n 1]);
xc = cos(th);
zp = repmat(-y.^2+1,[1 n]);
zc(zc>zp) = NaN;
surf(xc,y,zc); hold on
surf(x,y,zp,'facealpha',0.4);
shading flat
axis equal

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by