takanaka kouzou
/
SDR_AM_Rx_CIC_FIR
AM中波放送用SDR.CICフィルタと通常のFIRフィルタを組み合わせて使用.CQ出版社「トランジスタ技術」誌に掲載予定
SDR_Library/Iir1st.hpp@1:ca43ee5ea802, 2021-07-31 (annotated)
- Committer:
- tza
- Date:
- Sat Jul 31 09:11:29 2021 +0000
- Revision:
- 1:ca43ee5ea802
- Parent:
- 0:9c28f5905a1a
a
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MikamiUitOpen | 0:9c28f5905a1a | 1 | //----------------------------------------------------------------- |
MikamiUitOpen | 0:9c28f5905a1a | 2 | // 一次の IIR フィルタ |
MikamiUitOpen | 0:9c28f5905a1a | 3 | // y[n] = a1*y[n-1] + (1 - a1)*x[n] |
MikamiUitOpen | 0:9c28f5905a1a | 4 | // |
MikamiUitOpen | 0:9c28f5905a1a | 5 | // 2020/08/05, Copyright (c) 2020 MIKAMI, Naoki |
MikamiUitOpen | 0:9c28f5905a1a | 6 | //----------------------------------------------------------------- |
MikamiUitOpen | 0:9c28f5905a1a | 7 | |
MikamiUitOpen | 0:9c28f5905a1a | 8 | #include "mbed.h" |
MikamiUitOpen | 0:9c28f5905a1a | 9 | |
MikamiUitOpen | 0:9c28f5905a1a | 10 | #ifndef IIR_1ST_HPP |
MikamiUitOpen | 0:9c28f5905a1a | 11 | #define IIR_1ST_HPP |
MikamiUitOpen | 0:9c28f5905a1a | 12 | namespace Mikami |
MikamiUitOpen | 0:9c28f5905a1a | 13 | { |
MikamiUitOpen | 0:9c28f5905a1a | 14 | class Iir1st |
MikamiUitOpen | 0:9c28f5905a1a | 15 | { |
MikamiUitOpen | 0:9c28f5905a1a | 16 | public: |
MikamiUitOpen | 0:9c28f5905a1a | 17 | // コンストラクタ |
MikamiUitOpen | 0:9c28f5905a1a | 18 | // a1 フィルタの係数 |
MikamiUitOpen | 0:9c28f5905a1a | 19 | Iir1st(float a1) : A1_(a1), B0_(1.0f - a1), yn_(0) {} |
MikamiUitOpen | 0:9c28f5905a1a | 20 | |
MikamiUitOpen | 0:9c28f5905a1a | 21 | // フィルタの実行 |
MikamiUitOpen | 0:9c28f5905a1a | 22 | float Execute(float xn) |
MikamiUitOpen | 0:9c28f5905a1a | 23 | { |
MikamiUitOpen | 0:9c28f5905a1a | 24 | yn_ = A1_*yn_ + B0_*xn; |
MikamiUitOpen | 0:9c28f5905a1a | 25 | return yn_; |
MikamiUitOpen | 0:9c28f5905a1a | 26 | } |
MikamiUitOpen | 0:9c28f5905a1a | 27 | |
MikamiUitOpen | 0:9c28f5905a1a | 28 | private: |
MikamiUitOpen | 0:9c28f5905a1a | 29 | const float A1_; // フィルタ係数 |
MikamiUitOpen | 0:9c28f5905a1a | 30 | const float B0_; // フィルタ係数 |
MikamiUitOpen | 0:9c28f5905a1a | 31 | float yn_; // 出力 |
MikamiUitOpen | 0:9c28f5905a1a | 32 | |
MikamiUitOpen | 0:9c28f5905a1a | 33 | // コピー・コンストラクタ,代入演算子の禁止のため |
MikamiUitOpen | 0:9c28f5905a1a | 34 | Iir1st(const Iir1st&); |
MikamiUitOpen | 0:9c28f5905a1a | 35 | Iir1st& operator=(const Iir1st&); |
MikamiUitOpen | 0:9c28f5905a1a | 36 | }; |
MikamiUitOpen | 0:9c28f5905a1a | 37 | } |
MikamiUitOpen | 0:9c28f5905a1a | 38 | #endif // IIR_1ST_HPP |