HTBasic Help
×
Menu
Index
Histogram
Histogram of a real array.
 
Loading        LOADSUB ALL FROM "HIST.HTS"
or LOADSUB FROM "MATHLIB.HTS"
or LOADSUB Histogram FROM "MATHLIB.HTS"
 
Usage                INTEGER N,Hist(*)
REAL Xmin,Xmax,A(*)
CALL Histogram(A(*),Xmin,Xmax,N,Hist(*))
 
Description                
Histogram divides the region of values between xmin and xmax into n equal intervals and counts the number of elements in the array A whose values lie in each interval. If a value in A lies below xmin or at or above xmax, it is not counted. If a value is exactly the value that separates two intervals, it is counted in the higher of the two intervals.
 
Histogram counts in the following manner: Let s be the width of an interval in which values are counted. S is defined by the expression
If a value in A falls between xmin, inclusive, and xmin+s, exclusive, the count in the first element of Hist is increased. If the value falls between xmin+s, inclusive, and xmin+2s, exclusive, the count in the second element of Hist is increased, etc.
 
Hist must contain at least n elements.
 
Errors                
Histogram causes an HTBasic error if its arguments are not of the types listed in the USAGE                section, above, if xmin xmax, if n is negative or zero, or if Hist contains fewer than n elements.