Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: F746_GUI F746_SAI_IO
SignalProcessing/IIR_Cascade.hpp
- Committer:
- MikamiUitOpen
- Date:
- 2016-04-14
- Revision:
- 0:f064b50f238e
File content as of revision 0:f064b50f238e:
//------------------------------------------------------------------------------ // 縦続形 IIR フィルタのクラス // // 2016/04/12, Copyright (c) 2016 MIKAMI, Naoki //------------------------------------------------------------------------------ #ifndef IIR_CASCADE_HPP #define IIR_CASCADE_HPP #include "Biquad.hpp" namespace Mikami { template<int order> class IIR_Cascade { public: // コンストラクタ IIR_Cascade(const Biquad::Coefs ck[], float g0) : g0_(g0) { for (int n=0; n<order/2; n++) hk_[n] = Biquad(ck[n]); Clear(); } // デストラクタ ~IIR_Cascade() { for (int n=0; n<order/2; n++) delete hk_[n]; } // 過去の計算結果を格納する配列のクリア void Clear() { for (int k=0; k<order/2; k++) hk_[k].Clear(); } // フィルタ処理の実行 float Execute(float xn) { float yn = g0_*xn; for (int k=0; k<order/2; k++) yn = hk_[k].Execute(yn); return yn; } private: Biquad hk_[order/2]; // 2 次の IIR フィルタ const float g0_; // 利得定数 }; } #endif // IIR_CASCADE_HPP