Find voulume of Tetrahedron
21 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Prachi Kulkarni
2022-1-13
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);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Mathematics and Optimization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!