![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Chapter003_TRobot
Dependencies: F746_GUI Array_Matrix TS_DISCO_F746NG mbed LCD_DISCO_F746NG BSP_DISCO_F746NG SDFileSystem_Warning_Fixed FrequencyResponseDrawer F746_SAI_IO
MyClasses_Functions/IIR_CascadeFrqResp.hpp
- Committer:
- MikamiUitOpen
- Date:
- 2016-04-19
- Revision:
- 0:04b43b777fae
File content as of revision 0:04b43b777fae:
//----------------------------------------------------------- // Frequency response for IIR filter of cascade form // // 2016/04/16, Copyright (c) 2016 MIKAMI, Naoki //----------------------------------------------------------- #ifndef IIR_CASCADE_FREQUENCY_RESPONSE_HPP #define IIR_CASCADE_FREQUENCY_RESPONSE_HPP #include "FrequancyResponseBase.hpp" #include "Biquad.hpp" namespace Mikami { class IIR_CascadeFrqResp : public FrequencyResponse { public: IIR_CascadeFrqResp() {} // 次数とフィルタの係数設定 void SetParams(int order, float g0, Biquad::Coefs ck[]) { order_ = order; g0_ = g0; ck_ = ck; } // 周波数応答の絶対値を返す関数, 引数: z^(-1) virtual float AbsH_z(Complex u) { Complex h = g0_; for (int k=0; k<order_/2; k++) h = h*(1.0f + (ck_[k].b1 + ck_[k].b2*u)*u) /((1.0f - (ck_[k].a1 + ck_[k].a2*u)*u)); return abs(h); } private: int order_; float g0_; Biquad::Coefs *ck_; // disallow copy constructor and assignment operator IIR_CascadeFrqResp(const IIR_CascadeFrqResp&); IIR_CascadeFrqResp& operator=(const IIR_CascadeFrqResp&); }; } #endif // IIR_CASCADE_FREQUENCY_RESPONSE_HPP