Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Area inside a closed curve

Subject: Area inside a closed curve

From: Ray Goldman

Date: 2 Aug, 2010 09:55:08

Message: 1 of 9

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.

Subject: Area inside a closed curve

From: Torsten Hennig

Date: 2 Aug, 2010 10:45:55

Message: 2 of 9

> 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.

If (x_i,y_i) (1<=i<=n) are the points that define
the closed curve (with (x_1,y_1)=(x_n,y_n)),
an approximation of the enclosed area is given by
0.5*sum_{i=1}^{n-1} 0.5*(x_i+x_(i+1))*(y_(i+1)-y_i) -
0.5*sum_{i=1}^{n-1} 0.5*(y_i+y_(i+1))*(x_(i+1)-x_i)

This is the discrete form of the well-known
formula
|A| = int_{A} 1 dA = 1/2 * int_{C} (x dy - y dx)
where C is the curve enclosing the area A.

Best wishes
Torsten.

Subject: Area inside a closed curve

From: ImageAnalyst

Date: 2 Aug, 2010 11:06:54

Message: 3 of 9

Would the polyarea() function help you?

Subject: Area inside a closed curve

From: Ray Goldman

Date: 4 Aug, 2010 00:29:13

Message: 4 of 9

Torsten Hennig <Torsten.Hennig@umsicht.fhg.de> wrote in message <108868415.40482.1280745985673.JavaMail.root@gallium.mathforum.org>...
> > 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.
>
> If (x_i,y_i) (1<=i<=n) are the points that define
> the closed curve (with (x_1,y_1)=(x_n,y_n)),
> an approximation of the enclosed area is given by
> 0.5*sum_{i=1}^{n-1} 0.5*(x_i+x_(i+1))*(y_(i+1)-y_i) -
> 0.5*sum_{i=1}^{n-1} 0.5*(y_i+y_(i+1))*(x_(i+1)-x_i)
>
> This is the discrete form of the well-known
> formula
> |A| = int_{A} 1 dA = 1/2 * int_{C} (x dy - y dx)
> where C is the curve enclosing the area A.
>
> Best wishes
> Torsten.

Hi Torsten
Thank you for replying, can you please clarify the equation more, I'm having problem with this part (0.5*sum_{i=1}^{n-1}), what is it and does it relate to the rest of the equation.

Thank you.

Subject: Area inside a closed curve

From: Roger Stafford

Date: 4 Aug, 2010 03:43:06

Message: 5 of 9

"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

Subject: Area inside a closed curve

From: Roger Stafford

Date: 4 Aug, 2010 03:55:06

Message: 6 of 9

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <i3anka$di4$1@fred.mathworks.com>...
> 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
- - - - - - - -
  Oops! I meant to write:

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

Roger Stafford

Subject: Area inside a closed curve

From: Steve Amphlett

Date: 4 Aug, 2010 04:58:04

Message: 7 of 9

"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.

Others have given you code. If you want to know the background to it, look up "Green's Theorem" and "planimeter". All very elegant and satisfying.

Subject: Area inside a closed curve

From: Torsten Hennig

Date: 4 Aug, 2010 06:57:11

Message: 8 of 9

> Torsten Hennig <Torsten.Hennig@umsicht.fhg.de> wrote
> in message
> <108868415.40482.1280745985673.JavaMail.root@gallium.m
> athforum.org>...
> > > 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.
> >
> > If (x_i,y_i) (1<=i<=n) are the points that define
> > the closed curve (with (x_1,y_1)=(x_n,y_n)),
> > an approximation of the enclosed area is given by
> > 0.5*sum_{i=1}^{n-1} 0.5*(x_i+x_(i+1))*(y_(i+1)-y_i)
> -
> > 0.5*sum_{i=1}^{n-1} 0.5*(y_i+y_(i+1))*(x_(i+1)-x_i)
> >
> > This is the discrete form of the well-known
> > formula
> > |A| = int_{A} 1 dA = 1/2 * int_{C} (x dy - y dx)
> > where C is the curve enclosing the area A.
> >
> > Best wishes
> > Torsten.
>
> Hi Torsten
> Thank you for replying, can you please clarify the
> equation more, I'm having problem with this part
> (0.5*sum_{i=1}^{n-1}), what is it and does it relate
> to the rest of the equation.
>
> Thank you.

If you collect terms in the two sums, you get as
a simplified result that |A| is approximately
0.5*sum_{i=1}^{n-1} (x_i*y_(i+1)-x_(i+1)*y_i)
= 0.5*((x_1*y_2-x_2*y_1)+(x_2*y_3-x_3*y_2)+...+
(x_(n-1)*y_n-x_n*y_(n-1)))
which should equal the result if you use
- as Imageanalyst suggested - the polyarea
function in MATLAB.
It is the area inside the polygon formed by the
vertices (x_1,y_1),...(x_n,y_n) where
(x_1,y_1) = (x_n,y_n).

Best wishes
Torsten.

Subject: Area inside a closed curve

From: Mutharasu

Date: 12 Mar, 2012 09:04:14

Message: 9 of 9

Dear friend there is no standard formula available to find the area of an irregular closed curve( regular are - squares, triangles, circles , parabolas, etc).
For these we have numerical methods like Simson's 1/3 rule, 3/8 rule, Trapeziodal rule , etc.
when ever you want to find the area of an irregular closed curve, Just scanned the picture and mail me..... i will send you the area in sq.units
I have found one technique which gives most accurate solution. You can check my answer with any of your available above said methods.....
Regards
Dr. M.S. Mutharasu

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us