The experiment using this program is introduced on "Interface" No.12, CQ publishing Co.,Ltd, 2014. 本プログラムを使った実験は,CQ出版社のインターフェース 2014年12月号で紹介しています.

Dependencies:   DSProcessingIO mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers FIR_Direct.hpp Source File

FIR_Direct.hpp

00001 //--------------------------------------------------------------
00002 // FIR filter ---- Direct structure
00003 // copyright (c) 2014 MIKAMI, Naoki, 2014/06/20
00004 //--------------------------------------------------------------
00005 
00006 #ifndef FIR_DIRECT_HPP
00007 #define FIR_DIRECT_HPP
00008 
00009 #include "mbed.h"
00010 #include "FirBaseClass.hpp"
00011 
00012 namespace Mikami
00013 {
00014     template<int order> class FirDirect : public FirBase<order>
00015     {
00016     public:
00017         using FirBase<order>::xn_;
00018         
00019         FirDirect(const float hk[]) : FirBase<order>(hk) {}
00020         
00021         virtual float Execute(float xin)
00022         {
00023             xn_[0] = xin;
00024 
00025             float acc = 0;
00026             for (int k=0; k<=order; k++)
00027                 acc = acc + hm_[k]*xn_[k];
00028 
00029             FirBase<order>::Move();
00030 
00031             return acc;
00032         }
00033     };
00034 }
00035 #endif  // FIR_DIRECT_HPP
00036