Hi, I'm trying to get the area that lays under a experimentally created curve in relation to mean-curve. My problem is, that i want to have only either the areas that are above or below the curve.
My head is starting to burn of thinking...
Thanks for any help,
Chris
An alternative that I believe will also work is below. Use calcPosOrNegArea(w) to get the positive area, and calcPosOrNegArea(w,neg=1) to get the negative area.
The presumption in both this and the function from Andreas is, you are determining the area under a curve that is plotted as a scaled wave. Should you be wanting to get the area under a function that is plotted as a y-wave versus an x-wave, you will have to modify the functions correspondingly to use the Integrate operations.
Function calcPosOrNegArea(w,[neg]) wave w variable neg
duplicate/free w,w1
if(ParamIsDefault(neg))
w1 = w >= 0 ? w : Nan else
w1 = w <0 ? w : Nan endif
return(area(w1)) end
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
Should you be wanting to get the area under a function that is plotted as a y-wave versus an x-wave, you will have to modify the functions correspondingly to use the Integrate operations.
wave w
duplicate/free w,w1
w1=abs(w)
variable a0=area(w)
variable a1=area(w1)
return (a1+a0)/2
end
Andreas
May 31, 2010 at 12:45 pm - Permalink
The presumption in both this and the function from Andreas is, you are determining the area under a curve that is plotted as a scaled wave. Should you be wanting to get the area under a function that is plotted as a y-wave versus an x-wave, you will have to modify the functions correspondingly to use the Integrate operations.
wave w
variable neg
duplicate/free w,w1
if (ParamIsDefault(neg))
w1 = w >= 0 ? w : Nan
else
w1 = w < 0 ? w : Nan
endif
return (area(w1))
end
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
June 1, 2010 at 09:33 am - Permalink
Or the AreaXY function.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
June 1, 2010 at 09:56 am - Permalink
http://www.igorexchange.com/node/1533
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
June 15, 2010 at 10:38 pm - Permalink