Calculate the volume of a body

2 views (last 30 days)
Nikodin Sedlarevic
Nikodin Sedlarevic on 29 Apr 2022
Answered: Jan on 29 Apr 2022
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;

Answers (1)

Jan
Jan on 29 Apr 2022
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.

Community Treasure Hunt

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

Start Hunting!