The moving average purpose is to filter some data that comes from a source that may be unprecise. See more information about Moving Average here: http://en.wikipedia.org/wiki/Moving_average
MovingAverage.h@0:226202c7ea37, 2013-04-14 (annotated)
- Committer:
- Alegrowin
- Date:
- Sun Apr 14 01:02:39 2013 +0000
- Revision:
- 0:226202c7ea37
Initial Commit; ; This library purpose is to provide a tool to filter data from a source that is not precise enough,; ; Read more here:http://en.wikipedia.org/wiki/Moving_average
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Alegrowin | 0:226202c7ea37 | 1 | #ifndef MOVING_AVERAGE_H |
Alegrowin | 0:226202c7ea37 | 2 | #define MOVING_AVERAGE_H |
Alegrowin | 0:226202c7ea37 | 3 | |
Alegrowin | 0:226202c7ea37 | 4 | template <class T> |
Alegrowin | 0:226202c7ea37 | 5 | class MovingAverage |
Alegrowin | 0:226202c7ea37 | 6 | { |
Alegrowin | 0:226202c7ea37 | 7 | private: |
Alegrowin | 0:226202c7ea37 | 8 | T AverageFilter[]; |
Alegrowin | 0:226202c7ea37 | 9 | T Average; |
Alegrowin | 0:226202c7ea37 | 10 | |
Alegrowin | 0:226202c7ea37 | 11 | unsigned char NextElement; |
Alegrowin | 0:226202c7ea37 | 12 | unsigned char MaxLength; |
Alegrowin | 0:226202c7ea37 | 13 | public: |
Alegrowin | 0:226202c7ea37 | 14 | MovingAverage(unsigned char maxLength, T defaultValue); |
Alegrowin | 0:226202c7ea37 | 15 | T GetAverage(); |
Alegrowin | 0:226202c7ea37 | 16 | void Insert(T value); |
Alegrowin | 0:226202c7ea37 | 17 | }; |
Alegrowin | 0:226202c7ea37 | 18 | |
Alegrowin | 0:226202c7ea37 | 19 | #endif |