public class Interpolated1DHistogram extends Object
Interpolated1DHistogram
class is used to create interpolates
histograms for a certain range of values ([min,max[) with a defined range of
bins. Values that are added to the histogram are interpolated to ne nearest
neighboring bin according to the distance of the value to the center of the
bin. If the according neighbor is out of the range of the histogram, then the
according interpolated value is skipped silently and the value of one bin is
raised only:
Interpolated1DHistogram ih = new Interpolated1DHistogram(0,3,3); ih.add(0); // histogram: 0.5, 0, 0 ih.add(1.5); // histogram: 0.5, 1, 0
Constructor and Description |
---|
Interpolated1DHistogram(double min,
double max,
int binCount)
Initializes the histogram with user defined min, max and count values
|
Modifier and Type | Method and Description |
---|---|
void |
add(double pos)
Raises the histogram at the specivied key position by 1 (might decrease
due to interpolation).
|
void |
add(double pos,
double value)
Raises the histogram at the specivied key position by
value (might decrease due to interpolation). |
void |
clear()
Resets the data array by filling it with zero.
|
double[] |
getData()
Returns a reference(!)
|
String |
toString()
Returns a string representation of the histogram.
|
public Interpolated1DHistogram(double min, double max, int binCount)
min
- inclusive lower boundmax
- exclusive upper boundbinCount
- amount of bins between min and maxpublic void add(double pos)
pos
- in the range of [min, max[public void add(double pos, double value)
value
(might decrease due to interpolation).pos
- in the range of [min, max[value
- public double[] getData()
public void clear()
Copyright © 2013. All Rights Reserved.