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일)
dang thai bao
dang thai bao 2021년 5월 11일
답변: DGM 2021년 5월 11일
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