Azzera filtri
Azzera filtri

Calculate the volume of a body

4 visualizzazioni (ultimi 30 giorni)
Nikodin Sedlarevic
Nikodin Sedlarevic il 29 Apr 2022
Risposto: Jan il 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;

Risposte (1)

Jan
Jan il 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!

Translated by