RunningMedian2 (community library)
|Author||Rob dot Tillaart at gmail dot com|
|Maintainer||Rob Tillaart firstname.lastname@example.org|
|All Versions||0.2.16, 0.2.15, 0.2.14, 0.2.13, 0.2.12, 0.2.11, 0.2.1, 0.1.15|
The library stores the last N individual values in a buffer to select the median. This will filter outliers in a chain of samples very well.
Library Read Me
This content is provided by the library maintainer and has not been validated or approved.
Arduino library to determine the running median by means of a circular buffer.
Running Median looks like a running average with a small but important twist. Running average averages the last N samples while the running median takes the last N samples, sort them and take the middle one, or the average of the middle two.
Important differences between running average and running median:
- Running median will return real data (e.g. a real sample from a sensor) if one uses an odd size of the buffer (preferred). Running average may return a value that is never sampled.
- Running median will give zero weight to outliers, and 100% to the middle sample, whereas running average gives the same weight to all samples.
- Running median will give often constant values for some time.
- As one knows the values in the buffer one can predict to some extend how much the next samples will change the running median.
- Running median is a bit harder as one needs to keep the values in order to remove the oldest and keep them sorted to be able to select the median.
Browse Library Files