Fernando Cosentino / MovingAverage
Embed: (wiki syntax)

« Back to documentation index

MovingAverage Class Reference

MovingAverage Class Reference

Receives a constant stream of samples and outputs the last available average. More...

#include <MovingAverage.h>

Public Member Functions

 MovingAverage (int number_of_samples)
 Creates an instance of the MovingAverage class.
float filter (float value)
 Inserts a new value into the filter, and returns the updated average.

Detailed Description

Receives a constant stream of samples and outputs the last available average.

The value is in the past by half the number of averaged samples.

Definition at line 34 of file MovingAverage.h.


Constructor & Destructor Documentation

MovingAverage ( int  number_of_samples )

Creates an instance of the MovingAverage class.

Parameters:
number_of_samplesNumber of samples to average per output value. Maximum value is 64.

Definition at line 3 of file MovingAverage.cpp.


Member Function Documentation

float filter ( float  value )

Inserts a new value into the filter, and returns the updated average.

Parameters:
valueThe new value to be inserted.
Returns:
The updated average including the new value.

Definition at line 9 of file MovingAverage.cpp.