Find voulume of Tetrahedron

35 次查看(过去 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)

采纳的回答

Prachi Kulkarni
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 CenterFile Exchange 中查找有关 3-D Volumetric Image Processing 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by