To find Volume under Surface

16 views (last 30 days)
Himanshu Kumar Modi
Himanshu Kumar Modi on 23 Dec 2021
Answered: DGM on 23 Dec 2021
Using MATLAB,calculate the volume of the solid bounded by the surface x=0; y=0; x+y+z=1 and z=0 and visualize the solid.

Accepted Answer

DGM
DGM on 23 Dec 2021
Rearrange the implicit equation and observe symmetry and intersections to simplify the task.
syms x y
z0 = 0;
z1 = x+y-1;
vol = int(int(abs(z1)/2,x,0,1),y,0,1)
vol = 
hold on; grid on
h1 = fsurf(z0,[0 1 0 1]);
h2 = fsurf(z1,[0 1 0 1]);
set(h1,'facealpha',0.5);
set(h2,'facealpha',1);
view(-26,16)
I'm not going to bother pruning the surfaces or plotting the vertical faces. This should suffice to make the volume understandable. There are also plenty of other examples of plotting piecewise surfaces using standard tools like surf().

More Answers (0)

Community Treasure Hunt

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

Start Hunting!