area under the curve - FaverageXY

Dear Igor guru,

I am using FaverageXY to measure the area under the curve (AUC). According to Igor's manual (below), the AUC is calculated upon x=0.  On the data that I have, it looks like the curve falling below x=0 would return a negative AUC. Is AUC the sum of the AUC measures above (positive) and below (negative) zero if the curve is across x=0 line? 

Thanks,

Judy Chen

FaverageXY gives you trapezoidal average, not trapezoidal area. Use area and areaXY for area.

All of these are measured from y=0 in both positive and negative directions.

If you are still not certain what the functions do, try making some waves with a few points and explore what happens as you change the data.

 

Yes, negative Y values contribute negative areas to the result:

make/n=101 junk
setscale/I x 0,2*pi,junk
•junk=sin(x)
print faverage(junk)
  3.21625e-18

If you want negative portions of your data to contribute nothing to the result, you can make a new data set with negative portions set to zero:

duplicate junk, junknonnegative
•junknonnegative = junk[p] < 0 ? 0 : junk[p]
print faverage(junknonnegative)
  0.318205

If you want negative portions to contribute positive areas to the result, the new data set would be formed using abs():

duplicate junk, junkabs
•junkabs = abs(junk)
print faverage(junkabs)
  0.63641