Calculate the volume of a body
조회 수: 2 (최근 30일)
이전 댓글 표시
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;
댓글 수: 0
답변 (1개)
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!