Area of a triangle

34 visualizzazioni (ultimi 30 giorni)
Luffy
Luffy il 14 Giu 2012
Spostato: DGM il 21 Feb 2023
Is there a function to find area of triangle,not by using Heron's algorithm.

Risposta accettata

Dr. Seis
Dr. Seis il 14 Giu 2012
How about polyarea?
>> x = [0, 0, 4];
>> y = [0, 3, 0];
>> area1 = polyarea(x,y)
area1 =
6
>> area2 = 0.5*3*4
area2 =
6
  5 Commenti
Dr. Seis
Dr. Seis il 22 Giu 2012
I think you would have to do some sort of coordinate transform (to still use the "polyarea" function above), such that all the coordinate values for one of the dimensions (e.g., the z-coordinate) are 0. But it seems using Heron's algorithm would be much easier.
SaN AruL
SaN AruL il 25 Nov 2016
Spostato: DGM il 21 Feb 2023
thank you Dr. Seis..........

Accedi per commentare.

Più risposte (1)

AYUSH MISHRA
AYUSH MISHRA il 26 Mag 2020
function area=tri_area(b,h,n)
area=0.5*b*h*n;
end
%Here b=base of triangle , h=height of triangle , n=number of triangle
Example
area= tri_area(2,3,5)
area =
15

Categorie

Scopri di più su Cartesian Coordinate System Conversion in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by