The experiment using this program is introduced on "Interface" No.12, CQ publishing Co.,Ltd, 2014. 本プログラムを使った実験は,CQ出版社のインターフェース 2014年12月号で紹介しています.
Dependencies: DSProcessingIO mbed
Diff: FIR_Direct.hpp
- Revision:
- 0:b811ec8a7e8a
diff -r 000000000000 -r b811ec8a7e8a FIR_Direct.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FIR_Direct.hpp Tue Jul 15 08:45:04 2014 +0000 @@ -0,0 +1,36 @@ +//-------------------------------------------------------------- +// FIR filter ---- Direct structure +// copyright (c) 2014 MIKAMI, Naoki, 2014/06/20 +//-------------------------------------------------------------- + +#ifndef FIR_DIRECT_HPP +#define FIR_DIRECT_HPP + +#include "mbed.h" +#include "FirBaseClass.hpp" + +namespace Mikami +{ + template<int order> class FirDirect : public FirBase<order> + { + public: + using FirBase<order>::xn_; + + FirDirect(const float hk[]) : FirBase<order>(hk) {} + + virtual float Execute(float xin) + { + xn_[0] = xin; + + float acc = 0; + for (int k=0; k<=order; k++) + acc = acc + hm_[k]*xn_[k]; + + FirBase<order>::Move(); + + return acc; + } + }; +} +#endif // FIR_DIRECT_HPP +