Calculate the volume of a body

2 次查看(过去 30 天)
Nikodin Sedlarevic
Nikodin Sedlarevic 2022-4-29
回答: Jan 2022-4-29
Calculate the volume of a body whose upper surface is described by the function g, whose lower surface is described by z(x, y) ≡0 and whose floor plan is the union of two rectangles:
[-0.5,3.90] x [-0.5,3.70] U [-3.90,0.5]x[-3.70,0.5]
I tried like this, but is not the correct answer. What I have to change to be correct?
g = @(x, y) 1./((2+1.1.*x.^2+1.1.*y.^2).^(1/2));
a=0.0;
b=4.40;
c=0.0;
d=4.20;
int2 = integral2(g,-0.50,3.90,-0.50,3.70);
int3 = integral2(g,-3.90,0.50,-3.70,0.50);
vol = int2+int3;

回答(1 个)

Jan
Jan 2022-4-29
x1 = [-0.5, 3.90];
y1 = [-0.5, 3.70];
x2 = [-3.90, 0.5];
y2 = [-3.70, 0.5];
axes('NextPlot', 'add');
line(x1([1,1,2,2,1]), y1([1,2,2,1,1]))
line(x2([1,1,2,2,1]), y2([1,2,2,1,1]))
The 2 areas overlap, so the volume above the overlapping rectangle is counted twice. Subtract it.

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by