From: Ray Goldman on
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.
From: Torsten Hennig on
> 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.
From: ImageAnalyst on
Would the polyarea() function help you?
From: Ray Goldman on
Torsten Hennig <Torsten.Hennig(a)umsicht.fhg.de> wrote in message <108868415.40482.1280745985673.JavaMail.root(a)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.
From: Roger Stafford on
"Ray Goldman" <kmmansory(a)yahoo.com> wrote in message <i364ls$nh3$1(a)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