modm API documentation
modm::filter::Median< T, N > Class Template Reference

Median filter. More...

#include <modm/math/filter/median.hpp>

Public Member Functions

 Median (const T &initialValue=0)
 Constructor. More...
void append (const T &input)
 Append new value.
void udpate ()
 calculate median
const T getValue () const
 Get median value.

Detailed Description

template<typename T, int N>
class modm::filter::Median< T, N >

Median filter.

Calculates the median of a input set. Useful for eliminating spikes from the input. Adds a group delay of N/2 ticks for the signal.

Implementation are available for N = 3, 5, 7 and 9. To find the median the signal values will be partly sorted, but only as much as needed to find the median.

// create a new filter for five samples
// append new signal values
// calculate the median
output = filter.getValue();
Template Parameters
TInput type
NNumber of samples

Constructor & Destructor Documentation

template<typename T , int N>
modm::filter::Median< T, N >::Median ( const T &  initialValue = 0)


initialValueValue will be set for the complete input buffer.

The documentation for this class was generated from the following file: