Package Filters
Class MovingAverageFilter
java.lang.Object
Filters.AbstractFilter
Filters.MovingAverageFilter
- All Implemented Interfaces:
Filter
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Gets the delay of the filter - rarely used, but can be important for some processing tasks.void
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 valueMethods inherited from class Filters.AbstractFilter
runFilter, runFilter
-
Constructor Details
-
MovingAverageFilter
public MovingAverageFilter(int filterLen)
-
-
Method Details
-
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 interfaceFilter
- Specified by:
prepareFilter
in classAbstractFilter
-
runFilter
public double runFilter(double data) Description copied from interface:Filter
Runs the filter on a single data value- Specified by:
runFilter
in interfaceFilter
- Specified by:
runFilter
in classAbstractFilter
- 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.
-