
Graphing cylinders on same axis
조회 수: 9 (최근 30일)
이전 댓글 표시
I'm trying to graph these two cylinders on the same axis and then draw the cross section of the region bounded by them,but I'm not sure I'm doing it right. The end goal is to choose an order of integration based on the results of the first part and compute the volume of the region.
syms x y z
cyl = x^2 + y^2 - 1;
cyl2 = x^2 + z^2 - 1;
fimplicit(cyl), hold on
fimplicit(cyl2)
댓글 수: 0
채택된 답변
Sam Chak
2022년 4월 23일
Can you try using this code to show your how your cylinders look like? Then we see the region that you want to find the volume.
r = 1; % radius
n = 200;
[X, Y, Z] = cylinder(r, n);
h = 2; % height
Z = h*Z;
surf(X, Y, Z, 'facecolor', [179/255, 205/255, 227/255], 'LineStyle', 'none')
hold on
fill3(X(2,:), Y(2,:), Z(2,:), [251/255, 180/255, 174/255], 'LineStyle', 'none'); % top
fill3(X(1,:), Y(1,:), Z(1,:), [204/255, 235/255, 197/255], 'LineStyle', 'none'); % bottom
hold off
axis square

댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!