chips> x = [0.5:6.0:0.05]
chips> y = 3 + 30 * exp( - (x-2.0)^2 / 0.1 )
chips> xl = [ 0.5, 1.0, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 3.0, 3.5 ]
chips> xh = [ 1.0, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 3.0, 3.5, 6.0 ]
chips> (g,q) = grpBin( x, xl, xh )
chips> ysum = grpGetGroupSum( y, g )
chips> nchan = grpGetChansPerGroup( g )
chips> i = where( g == 1 )
chips> yavg = ysum[i] / nchan[i]
chips> curve( x, y )
chips> simpleline
chips> curve( x[i], yavg )
chips> symbol square
chips> symbol red
Here we take the function
y = 3 + 30 * exp( -(x-2)^2 / 0.1 )
and apply an irregular set of group boundaries,
specified by the xl and xh arrays.
The plot shows the original data (the solid line and the
crosses) and the grouped data (as the
red squares); the latter has been normalised by the
width of each group and is displayed at the left-edge
of each group.