I guess I understood the help file wrong. Are the x1 and x2 the index? the way it was described, I thought it means only include elements whose value is between x1 and x2. (especially since -inf doesn't seem to make sense with index)
I guess I understood the help file wrong. Are the x1 and x2 the index? the way it was described, I thought it means only include elements whose value is between x1 and x2. (especially since -inf doesn't seem to make sense with index)
Igor Help File wrote:
mean(waveName [, x1, x2 ] )
The mean function returns the arithmetic mean of the wave for points from x=x1 to x=x2.
x1 and x2 are the wave scaling indexes over which the mean is computed.
If you have point scaling, they're the indexes of the wave (array), which start at 0 (0 is the index of the first value in the wave, 1 is the second, etc).
See this Igor help topic to explain what wave scaling is and how x isn't usually the point/index number.
Make ddd=x
•print mean(ddd,-inf,inf)
63.5
•print mean(ddd,1,inf)
64
// now change so that the first element is larger than the mean:
•ddd[0]=100
•print mean(ddd,-inf,inf)
64.2812
•print mean(ddd,1,inf)
64
I hope this helps,
A.G.
WaveMetrics, Inc.
March 7, 2012 at 03:49 pm - Permalink
March 7, 2012 at 04:57 pm - Permalink
x1 and x2 are the wave scaling indexes over which the mean is computed.
If you have point scaling, they're the indexes of the wave (array), which start at 0 (0 is the index of the first value in the wave, 1 is the second, etc).
See this Igor help topic to explain what wave scaling is and how x isn't usually the point/index number.
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
March 7, 2012 at 05:45 pm - Permalink