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: BSP_DISCO_F746NG_patch_fixed F746_GUI LCD_DISCO_F746NG SDFileSystem_Warning_Fixed TS_DISCO_F746NG mbed
MyClasses_Functions/IIR_CascadeFrqResp.hpp
- Committer:
- MikamiUitOpen
- Date:
- 2016-04-17
- Revision:
- 5:4a99dabc9180
- Parent:
- 3:492cb0f68526
File content as of revision 5:4a99dabc9180:
//-----------------------------------------------------------
// 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