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

Dependencies:   DSProcessingIO mbed

FIR_Direct.hpp

Committer:
CQpub0Mikami
Date:
2014-07-29
Revision:
1:b0a0a1ab01be
Parent:
0:b811ec8a7e8a

File content as of revision 1:b0a0a1ab01be:

//--------------------------------------------------------------
// 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