Package 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
  • 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 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.