histo(3)

NAME
histo - histogram package

SYNOPSIS
#include <histo.h> InitHisto (hg, lolimit, hilimit, bucketcount, ht) struct hgram *hg; double lolimit; double hilimit; int bucketcount; enum htype ht; UpdateHisto (hg, newval) register struct hgram *hg; double newval; PrintHisto (outfile, hg) FILE *outfile; register struct hgram *hg; PlotHisto (outfile, hg, graphtitle, xtitle, ytitle, psfileprefix) FILE *outfile; struct hgram *hg; char *graphtitle; char *xtitle; char *ytitle; char *psfileprefix;

DESCRIPTION
This is a statistics package that can be used to produce the mean, standard deviation and histogram of a set of numbers. The histogram can be one of three types: linear, log2 or log10. The package is used by calling the following routines:

InitHisto ()
    initialises the histogram hg by setting the lolimit, hilimit, bucketcount, and histogram type as specified by the user. lolimit specifies the origin of the horizontal axis. hilimit specifies the maximum value on the horizontal axis. It is required that hilimit be greater than the largest value of the input data. The histogram type htype is specified as LINEAR = 1, LOG2 = 2, or LOG10 = 3.

UpdateHist ()
    updates the histogram hg with newvalue to be entered.

PrintHisto ()
    provides the user with statistics for the input data. Statistics include the mean, standard deviation, and the 90% confidence interval.

PlotHisto ()
    the output of this file is used as input to the program csplot to produce a histogram of the input data.

DIAGNOSTICS
Negative return values indicate errors.

EXAMPLE

#include <libc.h>
#include "histo.h"
#define MAX 3
main ()
{
  int i, rc, bucketcount;
  struct hgram histogram1;
  double data[MAX], lolimit1,hilimit1;
  enum htype scale = LINEAR;
  FILE *fp1;
  data[0] = 5;
  data[1] = 15.4;
  data[2] = 10.6;
  bucketcount = 10;
  lolimit1 = 0;
  hilimit1 = 20;
  fp1 = fopen ("result1","w");
  if (fp1 == (FILE*) NULL) printf ("Cannot open\n");
  rc = InitHisto (&histogram1, lolimit1, hilimit1, bucketcount, scale);
  if (rc < 0) printf ("Initialisation failed\n");
  for (i = 0; i < MAX; i++)  UpdateHisto (&histogram1, data[i]);
  PrintHisto (fp1, &histogram1);
  fclose (fp1);
}

AUTHOR
M.Satya, 1991