![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Cutoff frequency variable LPF by IIR 6th-order Butterworth filter for ST Nucleo F401RE.
Dependencies: UIT_IIR_Filter UIT_ACM1602NI UITDSP_ADDA mbed UIT_AQM1602
IIR_Cascade.hpp
- Committer:
- MikamiUitOpen
- Date:
- 2015-07-25
- Revision:
- 6:116f72cda0f4
- Parent:
- 0:a9412b9e85b7
File content as of revision 6:116f72cda0f4:
//-------------------------------------------------------------- // IIR filter ---- Cascade structure // 2014/10/23, Copyright (c) 2014 MIKAMI, Naoki //-------------------------------------------------------------- #ifndef IIR_CASCADE_HPP #define IIR_CASCADE_HPP #include "mbed.h" #include "Biquad.hpp" namespace Mikami { // IIR filter -- Cascade structure template<int order> class IirCascade { private: Biquad hk_[order]; // Elements of cascade structure float g0_; // gain factor IirCascade(const IirCascade&); IirCascade& operator=(const IirCascade&); public: IirCascade() {} IirCascade(float g0, const Biquad::Coefs ck[]) { SetCoefs(g0, ck); } void SetCoefs(float g0, const Biquad::Coefs ck[]) { g0_ = g0; for (int k=0; k<order; k++) hk_[k] = Biquad(ck[k]); } float Execute(float xn) { float yn = g0_*xn; for (int k=0; k<order; k++) yn = hk_[k].Execute(yn); return yn; } void Clear() { for (int k=0; k<order; k++) hk_[k].Clear(); } }; } #endif // IIR_CASCADE_HPP