Filters
Class MovingAverageFilter
java.lang.Object
Filters.AbstractFilter
Filters.MovingAverageFilter
- All Implemented Interfaces:
- Filter
public class MovingAverageFilter
- extends AbstractFilter
Moving average filter. Stores a local array of values
input to the filter and subtracts off the oldest value
as it adds the newest one. This makes it as fast as a
decaying average filter.
- Author:
- Doug Gillespie
|
Method Summary |
int |
getFilterDelay()
Gets the delay of the filter - rarely used, but can be important
for some processing tasks. |
void |
prepareFilter()
Calculates the poles and zeros for the filter and sets up any memory
buffers required during real time operation. |
double |
runFilter(double data)
Runs the filter on a single data value |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
filterLen
private int filterLen
filterData
private double[] filterData
currIndex
private int currIndex
filterTotal
private double filterTotal
MovingAverageFilter
public MovingAverageFilter(int filterLen)
prepareFilter
public void prepareFilter()
- Description copied from interface:
Filter
- Calculates the poles and zeros for the filter and sets up any memory
buffers required during real time operation.
- Specified by:
prepareFilter in interface Filter- Specified by:
prepareFilter in class AbstractFilter
runFilter
public double runFilter(double data)
- Description copied from interface:
Filter
- Runs the filter on a single data value
- Specified by:
runFilter in interface Filter- Specified by:
runFilter in class AbstractFilter
- Returns:
- New data value
getFilterDelay
public int getFilterDelay()
- Description copied from interface:
Filter
- Gets the delay of the filter - rarely used, but can be important
for some processing tasks. For an IIRF filter, this would be
half the number of poles, for a moving average or median filter it
would be half the filter length.
- Returns:
- filter delay in samples.