Path: news.mathworks.com!newsfeed-00.mathworks.com!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!aioe.org!.POSTED!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to calculate area of enclosed loop?
Date: Thu, 11 Apr 2013 01:07:34 -0500
Organization: Aioe.org NNTP Server
Lines: 30
Message-ID: <kk5jv5$pm4$1@speranza.aioe.org>
References: <kk5ihf$es8$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: mVvjTPN33c0mdr/SDvD5RQ.user.speranza.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5
X-Notice: Filtered by postfilter v. 0.8.2
Xref: news.mathworks.com comp.soft-sys.matlab:793236

On 4/11/2013 12:43 AM, J K wrote:
> I get data(x,y), and I plot it with Matlab. The graph is an enclosed loop.
>How to calculate the area?
>
> The idea is take the upward integral subtract the lower integral. But I don't kow
>how to translate it into Matlab code.
>
> Can you guys help me with the code?
>

It sounds that you are looking for Monte Carlo method?

i.e. generate many random points (using uniform distribution, make x and
y) and see the proportion of times the random point (x,y) is inside
the loop vs. outside the loop (easy to do since you know the max and min
values of your data.

This ratio is the same as the ratio of the area of the square that encloses
the loop. (you start by making a large square to put the loop inside).

Since you know the area of the outside square, then now you
know the area of the enclosed loop.

or something like that.

--Nasser