Pos. or neg part of the area under the curve

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
If I am not wrong you'll get the area above y=0 with the following function:
function calculatePosArea(w)
    wave w
    duplicate/free w,w1
    w1=abs(w)
    variable a0=area(w)
    variable a1=area(w1)
    return (a1+a0)/2
end

Andreas
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
jjweimer wrote:
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.


Or the AreaXY function.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com