This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Area of polygon


A = polyarea(X,Y)
A = polyarea(X,Y,dim)


A = polyarea(X,Y) returns the area of the polygon specified by the vertices in the vectors X and Y.

If X and Y are matrices of the same size, then polyarea returns the area of polygons defined by the columns X and Y.

If X and Y are multidimensional arrays, polyarea returns the area of the polygons in the first nonsingleton dimension of X and Y.

A = polyarea(X,Y,dim) operates along the dimension specified by scalar dim.


collapse all

L = linspace(0,2.*pi,9);
xv = 1.2*cos(L)';
yv = 1.2*sin(L)'; 

A = polyarea(xv,yv)
A = 4.0729
title(['Area = ' num2str(A)])
axis image

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced before R2006a