Question: mean() function result doesn't make sense

koensayr
Posts: 2
Joined: 2012-03-07
Location: United States

Hi all, how can this make sense??

How could the second one give a mean that is LOWER than the first one? wave1 are all real values.

print mean(wave1,-Inf,Inf)
735.886
print mean(wave1,1,Inf)
735.812

Thanks


Igor's picture
Posts: 335
Joined: 2007-06-29
Location: United States

Simple: if, for example, the first element of the wave is larger than the mean. Try this:

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.


[ last edited March 7, 2012 - 15:49 ]
koensayr
Posts: 2
Joined: 2012-03-07
Location: United States

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)


JimProuty's picture
Posts: 280
Joined: 2007-07-19
Location: United States

koensayr wrote:
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.

DisplayHelpTopic "The Waveform Model of Data"

--Jim Prouty
Software Engineer, WaveMetrics, Inc.


Back to top