AM中波放送用SDR.CICフィルタのみを使用.CQ出版社「トランジスタ技術」誌,2021年4月号に掲載

Dependencies:   mbed

Committer:
MikamiUitOpen
Date:
Wed Dec 01 00:37:44 2021 +0000
Revision:
3:878a48f15e89
Parent:
2:4bec6b2be809
4

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MikamiUitOpen 0:6906f8616429 1 //-----------------------------------------------------------------
MikamiUitOpen 0:6906f8616429 2 // 一次の IIR フィルタ
MikamiUitOpen 1:30d9fb51dec1 3 // y[n] = a1*y[n-1] + (1 - a1)*x[n]
MikamiUitOpen 0:6906f8616429 4 //
MikamiUitOpen 2:4bec6b2be809 5 // 2020/08/05, Copyright (c) 2020 MIKAMI, Naoki
MikamiUitOpen 0:6906f8616429 6 //-----------------------------------------------------------------
MikamiUitOpen 0:6906f8616429 7
MikamiUitOpen 0:6906f8616429 8 #include "mbed.h"
MikamiUitOpen 0:6906f8616429 9
MikamiUitOpen 0:6906f8616429 10 #ifndef IIR_1ST_HPP
MikamiUitOpen 0:6906f8616429 11 #define IIR_1ST_HPP
MikamiUitOpen 0:6906f8616429 12 namespace Mikami
MikamiUitOpen 0:6906f8616429 13 {
MikamiUitOpen 0:6906f8616429 14 class Iir1st
MikamiUitOpen 0:6906f8616429 15 {
MikamiUitOpen 0:6906f8616429 16 public:
MikamiUitOpen 0:6906f8616429 17 // コンストラクタ
MikamiUitOpen 0:6906f8616429 18 // a1 フィルタの係数
MikamiUitOpen 2:4bec6b2be809 19 Iir1st(float a1) : A1_(a1), B0_(1.0f - a1), yn_(0) {}
MikamiUitOpen 0:6906f8616429 20
MikamiUitOpen 0:6906f8616429 21 // フィルタの実行
MikamiUitOpen 0:6906f8616429 22 float Execute(float xn)
MikamiUitOpen 0:6906f8616429 23 {
MikamiUitOpen 0:6906f8616429 24 yn_ = A1_*yn_ + B0_*xn;
MikamiUitOpen 0:6906f8616429 25 return yn_;
MikamiUitOpen 0:6906f8616429 26 }
MikamiUitOpen 0:6906f8616429 27
MikamiUitOpen 0:6906f8616429 28 private:
MikamiUitOpen 0:6906f8616429 29 const float A1_; // フィルタ係数
MikamiUitOpen 0:6906f8616429 30 const float B0_; // フィルタ係数
MikamiUitOpen 0:6906f8616429 31 float yn_; // 出力
MikamiUitOpen 0:6906f8616429 32
MikamiUitOpen 2:4bec6b2be809 33 // コピー・コンストラクタ,代入演算子の禁止のため
MikamiUitOpen 0:6906f8616429 34 Iir1st(const Iir1st&);
MikamiUitOpen 0:6906f8616429 35 Iir1st& operator=(const Iir1st&);
MikamiUitOpen 0:6906f8616429 36 };
MikamiUitOpen 0:6906f8616429 37 }
MikamiUitOpen 2:4bec6b2be809 38 #endif // IIR_1ST_HPP