public class MedianFilter
extends java.lang.Object
Constructor and Description |
---|
MedianFilter(int length,
double init_val)
Initialize all things needed for the median filter.
|
Modifier and Type | Method and Description |
---|---|
double |
filter(double input)
Add a new input to the filter and get the current output from the filter
|
public MedianFilter(int length, double init_val)
length
- Number of previous values to consider for the median calculation. 5 is probably
a good starting point. Bigger length means more noise rejection, but also induces more
delay from input to output. Also, median calculations are non-linear in big-O time
complexity, so cranking this number up will really start to slow things down.init_val
- Initial output of the filter. Usually zero, unless you know something about
your system that we don't.