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: UIT_ACM1602NI UITDSP_ADDA mbed UIT_AQM1602
WindowingDesign.hpp
00001 //------------------------------------------------------------------------------ 00002 // Design of FIR filter of 4 type passbands using window method -- Header 00003 // 00004 // 2014/12/07, Copyright (c) 2014 MIKAMI, Naoki 00005 //------------------------------------------------------------------------------ 00006 00007 #ifndef HAMMING_WINDOWING_DESIGN_HPP 00008 #define HAMMING_WINDOWING_DESIGN_HPP 00009 00010 #include "mbed.h" 00011 00012 namespace Mikami 00013 { 00014 class WindowingDesign 00015 { 00016 public: 00017 struct Coefs { float a1, a2, b1; }; 00018 enum Type { LPF, HPF, BPF, BRF }; 00019 00020 // Constructor 00021 WindowingDesign(int order, float fs); 00022 00023 //Destructor 00024 ~WindowingDesign() 00025 { 00026 delete[] hm_; 00027 delete[] wn_; 00028 } 00029 00030 // Execution of design 00031 void Design(int order, Type pb, float fc1, float fc2, 00032 float hk[]); 00033 00034 private: 00035 static const float PI_ = 3.1415926536f; 00036 const float FS_; // Sampling frequency 00037 const float PI_FS_; 00038 00039 float *hm_; // For coefficients 00040 float *wn_; // For Windwo 00041 00042 int order_; // Order 00043 float fC_; // Cutoff frequency 00044 00045 // Calculation of coefficients for LPF 00046 void LpfCoefficients(); 00047 // Transform LPF to HPF, BPF, or BRF 00048 void Transform(Type pb, float w0); 00049 // Hamming window 00050 void HammWindow(); 00051 }; 00052 } 00053 #endif // HAMMING_WINDOWING_DESIGN_HPP
Generated on Sat Jul 16 2022 00:19:06 by
1.7.2