Find voulume of Tetrahedron
21 views (last 30 days)
Show older comments
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)
0 Comments
Accepted Answer
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);
More Answers (0)
See Also
Categories
Find more on Mathematics and Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!