Graphing region of intersection
4 次查看(过去 30 天)
显示 更早的评论
I'm trying to compute the volume of the region between x^2 + y^2 = 1 and x^2 + z^2 = 1. But first I need to draw the cross sections of the region bounded between the two functions in order to get the order of integration, but I'm confused on how to do that.
Here's what I have so far:
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 个评论
采纳的回答
Star Strider
2022-4-23
Using that definition, I would do something like this (with slightly edited code to plot two distinct concentric cylinders) —
syms x1 y1 x2 y2
x2 = 0.8*x1; % Change As Necessary To Get The Correct Dimensions
y2 = 0.8*y2; % Change As Necessary To Get The Correct Dimensions
cyl = x1^2 + y1^2 - 1;
cyl2 = x2^2 + y2^2 - 1;
figure
hfi1 = fimplicit(cyl);
xv1 = hfi1.XData;
yv1 = hfi1.YData;
hold on
hfi2 = fimplicit(cyl2);
xv2 = hfi2.XData;
yv2 = hfi2.YData;
hold off
axis('equal')
legend('cyl','cyl_2', 'Location','bestoutside')
figure
surf([xv1; xv1], [yv1; yv1], [zeros(size(yv1)); ones(size(yv1))], 'EdgeColor','interp')
hold on
surf([xv2; xv2], [yv2; yv2], [zeros(size(yv2)); ones(size(yv2))], 'EdgeColor','interp')
hold off
grid on
axis('equal')
colormap(turbo)
Make appropriate changes to get the desired results.
.
9 个评论
Star Strider
2022-4-24
Thank you.
I was trying to follow it to see if I could reproduce it.
syms x y z
f = x^2 + y^2 ==1;
g = x^2 + z^2 ==1;
zbounds = solve(g,z)
ybounds = solve(f,y)
Firststep = int(int(1,z,zbounds(2),zbounds(1)),y,ybounds(2),ybounds(1))
Volume = int(Firststep,x,-1,1)
.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




