# Area of a triangle

78 views (last 30 days)
Luffy on 14 Jun 2012
Answered: AYUSH MISHRA on 26 May 2020
Is there a function to find area of triangle,not by using Heron's algorithm.
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Accepted Answer

Dr. Seis on 14 Jun 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
##### 4 CommentsShowHide 3 older comments
Dr. Seis on 22 Jun 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.

Sign in to comment.

### More Answers (2)

SaN AruL on 25 Nov 2016
thank you Dr. Seis..........
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

AYUSH MISHRA on 26 May 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
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Categories

Find more on Elementary Polygons 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!