Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 432c56b6cd462ec133f773ac8097bf47 > files > 6

php-pear-Math_Histogram-0.9.0-11mdv2010.0.noarch.rpm

<?php

include 'Math/Histogram4D.php';

// let's generate some data
for ($i=0; $i < 100; $i++) {
	$a['x'][$i] = rand(0,4);
	$a['y'][$i] = rand(0,4);
	$a['z'][$i] = rand(0,4);
}

// and create a histogram from the data 
// with specific options
$h = new Math_Histogram4D();
$h->setBinOptions(
	array(
		'low' => array( 'x' => 0, 'y' => 0, 'z'=>0),
		'high' => array( 'x' => 4.0, 'y' => 4.0, 'z'=>4.0),
		'nbins' => array( 'x' => 4, 'y' => 4, 'z'=>4)
		)
	);
$h->setData($a);
$h->calculate();
// now we print out a comma separated set
echo $h->toSeparated();
// and the whole Histogram information
print_r($h->getHistogramInfo());

?>