LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate area of a XY graph

Solved!
Go to solution

 

  I'm building a gait evaluation program, and got stuck on this. I have a XY graph of hip x knee angles, and need to find the area of the plotted curve. I searched the forums, but found no way of doing this. Any ideas?

 

 

0 Kudos
Message 1 of 9
(7,135 Views)

Can you respost your VI for Labview 2011?

 

Also are you asking for the area under the curve...? If so there are multiple integration VIs.

0 Kudos
Message 2 of 9
(7,127 Views)

The endpoints of your graph are not at the same point. So you do not have a closed path which would define an irregular poygon.  How are you defining the area you want to measure?  The image below shows the detail of the endpoints.  If the point at Knee Angle = -4.0 had Hip Angle = 16.4 rather than 16.3 the curve would be open.

 

Lynn

0 Kudos
Message 3 of 9
(7,122 Views)

Right away. Saved as LV9

0 Kudos
Message 4 of 9
(7,119 Views)

 

    Lynn,

 

    The image is missing, but I understand what you mean.

    The graphs are cyclic (as walking pattern is cyclic), and beacuse of natural walking "irregularities", the end points will never match. The fact that the data is crossed at a point (figure 1) just means that the data collected is greater than 1 walking step. That can be corrected, and I can use the first value to force the polygon to close (see VI v.2). 

Download All
0 Kudos
Message 5 of 9
(7,111 Views)
Solution
Accepted by topic author Thiago_Caparelli

Green's Theorem instantly comes to mind:

 

GreensTheorem.png

 

I lopped off the first couple of points to make the graph more cyclic and get 1300.36 for the answer.  Passes the eyeball test but you should double check my rapidfire implementation (and my sketchy calculus recollections).

Message 6 of 9
(7,099 Views)

 

  Running against some known regular polygons (triangle, square, pentagon, hexagon) it worked flawlessly. But when I checked it against a circle, I found an odd behavior: The calculated area is slightly greater than the expected (and it increases as the area of the graph increases) when the expected result was to be a little smaller than the expected area. 

 

area.png

 

   Check the attached vi for an example.

  I'll try to figure that out.

 

 

0 Kudos
Message 7 of 9
(7,076 Views)

You are actually overclosing the curve (at least for how I calculated it).  I leave out the last point (which should equal the first).  If you leave out the last point you add, the results seem to make sense, and approach pi after about 1000 points.

0 Kudos
Message 8 of 9
(7,070 Views)

 

  You are right, I overlooked that. My thanks!

 

0 Kudos
Message 9 of 9
(7,057 Views)