Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Area inside a closed curve
Date: Wed, 4 Aug 2010 03:43:06 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 16
Message-ID: <i3anka$di4$1@fred.mathworks.com>
References: <i364ls$nh3$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1280893386 13892 172.30.248.35 (4 Aug 2010 03:43:06 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 4 Aug 2010 03:43:06 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:658849

"Ray Goldman" <kmmansory@yahoo.com> wrote in message <i364ls$nh3$1@fred.mathworks.com>...
> Hello,
> 
> I hope you guys can help, I have a closed curve I need to fine its area. I have two arrays (Flux, Current) that contain the data of the graph. the graph is simply drawn using Plot..
> when they are plotted against each other, they produce something like upside down cone, however, the shape is very irregular and has lots of dents.
> is there any functions that calculates the area inside the closed curve? Thank you so much in advance.
- - - - - - - - - - - -
  An alternate formula for the polygon's area is the following.  Let X and Y be n by 1 column vectors of the cartesian coordinates of the vertices of a closed polygon.  Then its area is (exactly):

 area = 1/2*abs(sum(X.*Y([2:end,1],:)-Y.*X([2:end,1],:)));

If the vertices are known to be in counterclockwise order around the polygon, then the 'abs' function is unnecessary.  Going clockwise around the polygon would give the negative of the area without the 'abs'.

  It should be pointed out that the polygon should never cross over itself as for example in a figure eight.  Otherwise some areas would cancel out other areas.

Roger Stafford