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

10 visualizaciones (últimos 30 días)
dang thai bao
dang thai bao el 11 de Mayo de 2021
Respondida: DGM el 11 de Mayo de 2021
i don't know how to do it

Respuestas (1)

DGM
DGM el 11 de Mayo de 2021
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

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by