17 #ifndef FIRST_ORDER_FILTER_H 18 #define FIRST_ORDER_FILTER_H 20 template <
typename FLT>
32 k_[0] = k_[1] = k_[3] = 0;
37 x_ = k_[0] * in + k_[1] *
x_;
38 const auto out = k_[2] * in + k_[3] *
x_;
44 template <
typename FLT>
50 this->
k_[3] = -1 / (1.0 + 2 * time_constant);
51 this->
k_[2] = -this->
k_[3];
52 this->
k_[1] = (1.0 - 2 * time_constant) * this->
k_[3];
53 this->
k_[0] = -this->
k_[1] - 1.0;
57 template <
typename FLT>
63 this->
k_[3] = -1 / (1.0 + 2 * time_constant);
64 this->
k_[2] = -this->
k_[3] * 2 * time_constant;
65 this->
k_[1] = (1.0 - 2 * time_constant) * this->
k_[3];
66 this->
k_[0] = 2 * time_constant * (-this->
k_[1] + 1.0);
70 #endif // FIRST_ORDER_FILTER_H
FLT update(const FLT &in)
FirstOrderHPF(const FLT &time_constant)
FirstOrderLPF(const FLT &time_constant)