>  Docs Center  >  Libraries  >  JHU/APL/S1R  >  HIST






      Compute histogram and corresponding x values. Allows weights.


Calling Sequence

      h = hist(a, [x, bin])


      a = input array. in
      bin = optional bin size. in
        Def is a size to give about 30 bins.
        NBINS over-rides bin value and returns value used.

Keyword Parameters


        MINH=mn sets min histogram value.
        MAXH=mx sets max histogram value.
        /EXACT means use MINH and MAXH exactly. Else
          adjusts so histogram goes to 0 at ends.
        /BIN_START means return x as bin start values,
          else x is returned as bin mid values.
        MAXBINS = mx. Set max allowed number of bins to mx.
          Over-rides default max of 1000.
        NBINS = n. Set number of bins used to about n.
          Actual bin size is a nice number giving about n bins.
          Over-rides any specified bin size.
        WEIGHT=wt Array of weights for each input array element.
          If this is given then the weights are summed for each
          bin instead of the counts. Returned histogram is a
          floating array. Slower.


      x = optionally returned array of x values. out
      h = resulting histogram. out

Common Blocks


      Notes: the boundaries of the histogram bins are positioned
        as follows: [...,-2*bin,-bin,0,bin,2*bin,...].
        To be compatable with plot,x,h,psym=10 the returned x
        array has values at the bin centers, that is:
        This may be over-ridden using the /BIN_START keyword
        which returns the X array with the bin starting X instead
        of the bin center.

Modification History

      R. Sterner. Converted to SUN 11 Dec, 1989.
      R. Sterner. Added MINH, MAXH, EXACT, and BIN_START, 14 Aug, 1991.
      R. Sterner. Fixed integer overflow problem for bin size. 2 Oct, 1992.
      R. Sterner. Added weighted histogram. 1994 Jan 27.
      M. R. Keller. Fixed integer/float problem for binsize test. 27 Jan 2003.
      R. Sterner, 2010 Jul 13 --- Converted arrays from () to [].
  Copyright (C) 1989, Johns Hopkins University/Applied Physics Laboratory
  This software may be used, copied, or redistributed as long as it is not
  sold and this copyright notice is reproduced on each copy made. This
  routine is provided as is without any express or implied warranties
  whatsoever. Other limitations apply as described in the file disclaimer.txt.

© 2020 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us