Find voulume of Tetrahedron

11 vues (au cours des 30 derniers jours)
Zaki Aslam
Zaki Aslam le 7 Jan 2022
Commenté : Zaki Aslam le 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)

Réponse acceptée

Prachi Kulkarni
Prachi Kulkarni le 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 commentaire
Zaki Aslam
Zaki Aslam le 14 Jan 2022
thanks, it worked!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 3-D Volumetric Image Processing dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by