@PublicationReference(author="Wikipedia", title="Finite impulse response", type=WebPage, year=2009, url="http://en.wikipedia.org/wiki/Finite_impulse_response") public class MovingAverageFilter extends AbstractStatefulEvaluator<java.lang.Double,java.lang.Double,FiniteCapacityBuffer<java.lang.Double>> implements DiscreteTimeFilter<FiniteCapacityBuffer<java.lang.Double>>
| Constructor and Description |
|---|
MovingAverageFilter(double... coefficients)
Creates a new instance of MovingAverageFilter
|
MovingAverageFilter(int numCoefficients)
Creates a new instance of MovingAverageFilter
|
MovingAverageFilter(Vector movingAverageCoefficients)
Creates a new instance of MovingAverageFilter
|
| Modifier and Type | Method and Description |
|---|---|
MovingAverageFilter |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
void |
convertFromVector(Vector parameters)
Converts the object from a Vector of parameters.
|
Vector |
convertToVector()
Converts the object to a vector.
|
FiniteCapacityBuffer<java.lang.Double> |
createDefaultState()
Creates a new default state object.
|
java.lang.Double |
evaluate(java.lang.Double input)
Evaluates the object using the given input and current state objects,
returning the output.
|
Vector |
getMovingAverageCoefficients()
Setter for movingAverageCoefficients
|
int |
getNumMovingAverageCoefficients()
Returns the number of coefficients in the moving-average filter.
|
void |
setMovingAverageCoefficients(Vector movingAverageCoefficients)
Setter for movingAverageCoefficients
|
evaluate, getState, resetState, setStateequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitevaluate, getState, resetState, setStatepublic MovingAverageFilter(int numCoefficients)
numCoefficients - Number of coefficients in the filter, with each coefficient having a
value of 1.0/numCoefficients.public MovingAverageFilter(double... coefficients)
coefficients - Coefficients of the moving-average filter. Element 0 is applied to the
most-recent input, Element 1 is applied to the second-most-recent,
and so forth.public MovingAverageFilter(Vector movingAverageCoefficients)
movingAverageCoefficients - Coefficients of the moving-average filter. Element 0 is applied to the
most-recent input, Element 1 is applied to the second-most-recent,
and so forth. The dimensionality of the Vector is the order of the
filter.public FiniteCapacityBuffer<java.lang.Double> createDefaultState()
StatefulEvaluatorcreateDefaultState in interface StatefulEvaluator<java.lang.Double,java.lang.Double,FiniteCapacityBuffer<java.lang.Double>>public java.lang.Double evaluate(java.lang.Double input)
StatefulEvaluatorevaluate in interface Evaluator<java.lang.Double,java.lang.Double>evaluate in interface StatefulEvaluator<java.lang.Double,java.lang.Double,FiniteCapacityBuffer<java.lang.Double>>input - The input to evaluate.public MovingAverageFilter clone()
AbstractCloneableSerializableObject class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone() to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone() as the basis for your implementation.clone in interface Vectorizableclone in interface CloneableSerializableclone in class AbstractStatefulEvaluator<java.lang.Double,java.lang.Double,FiniteCapacityBuffer<java.lang.Double>>public Vector convertToVector()
VectorizableconvertToVector in interface Vectorizablepublic void convertFromVector(Vector parameters)
VectorizableconvertFromVector in interface Vectorizableparameters - The parameters to incorporate.public int getNumMovingAverageCoefficients()
public Vector getMovingAverageCoefficients()
public void setMovingAverageCoefficients(Vector movingAverageCoefficients)
movingAverageCoefficients - Coefficients of the moving-average filter. Element 0 is applied to the
most-recent input, Element 1 is applied to the second-most-recent,
and so forth. The dimensionality of the Vector is the order of the
filter.