# Find voulume of Tetrahedron

33 views (last 30 days)
Zaki Aslam on 7 Jan 2022
Commented: Zaki Aslam on 14 Jan 2022
I need to find the volume of tetrahedron formed between coordinate planes and the plane x/a+y/b+z/c=1 using tripple integration where a, b, c are constants. I actually did solve it by dirichlet's form on pen and paper but having difficulty solve it in MATLAB.
the code:
clear all
clc
fun=@(x,y,z) input('Enter the equation of the plane: ')
V=integral3(fun,0,1,0,1,0,1)
display("Volume of the tetrahedron: ", V)

Prachi Kulkarni on 13 Jan 2022
Hi,
You can use the following code to compute the volume of the tetrahedron using triple integration.
intercepts = input("For the plane x/a+y/b+z/c = 1, enter values of a,b,c in the form [a b c]: ");
a = intercepts(1);
b = intercepts(2);
c = intercepts(3);
volume = @(x,y,z) ones(size(x));
xmin = 0; xmax = a;
ymin = 0; ymax = @(x) b*(1-x/a);
zmin = 0; zmax = @(x,y) c*(1-y/b-x/a);
V = integral3(volume,xmin,xmax,ymin,ymax,zmin,zmax);
V = abs(V);
disp(V);
You can crosscheck that the volume is correct using the formula for volume for tetrahedron i.e.
(1/3) x (Area of base triangle) x (Height)
V = (1/3)*((1/2)*a*b)*c;
V = abs(V);
disp(V);
##### 1 CommentShowHide None
Zaki Aslam on 14 Jan 2022
thanks, it worked!

R2021b

### Community Treasure Hunt

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

Start Hunting!