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: F746_GUI F746_SAI_IO FrequencyResponseDrawer SD_PlayerSkeleton UIT_FFT_Real
BilinearDesignLH.hpp
00001 //------------------------------------------------------------------------ 00002 // Design of Butterworth LPF and HPF using bilinear transform -- Header 00003 // 00004 // 2017/03/25, Copyright (c) 2017 MIKAMI, Naoki 00005 //------------------------------------------------------------------------ 00006 00007 #ifndef BILINEAR_BUTTERWORTH_HPP 00008 #define BILINEAR_BUTTERWORTH_HPP 00009 00010 #include "mbed.h" 00011 #include <complex> // requisite 00012 #include "Array.hpp" 00013 00014 namespace Mikami 00015 { 00016 typedef complex<float> Complex; // define "Complex" 00017 00018 class BilinearDesign 00019 { 00020 public: 00021 struct Coefs { float a1, a2, b1, b2; }; 00022 enum Type { LPF, HPF }; 00023 00024 // Constructor 00025 BilinearDesign(int order, float fs) 00026 : PI_FS_(PI_/fs), ORDER_(order), 00027 sP_(order/2), zP_(order/2), ck_(order/2) {} 00028 00029 // Destractor 00030 virtual ~BilinearDesign() {} 00031 00032 // Execution of design 00033 void Execute(float fc, Type pb, Coefs c[], float& g); 00034 00035 private: 00036 static const float PI_ = 3.1415926536f; 00037 const float PI_FS_; 00038 const int ORDER_; 00039 00040 Array<Complex> sP_; // Poles on s-plane 00041 Array<Complex> zP_; // Poles on z-plane 00042 Array<Coefs> ck_; // Coefficients of transfer function for cascade form 00043 float gain_; // Gain factor for cascade form 00044 00045 void Butterworth(); 00046 void Bilinear(float fc); 00047 void ToCascade(Type pb); 00048 void GetGain(Type pb); 00049 void GetCoefs(Coefs c[], float& gain); 00050 }; 00051 } 00052 #endif // BILINEAR_BUTTERWORTH_HPP
Generated on Tue Jul 12 2022 21:58:54 by
1.7.2