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 UIT_ADDA mbed
WindowingDesignLH.hpp
00001 //------------------------------------------------------------------------------ 00002 // Design of FIR filter of LPF and HPF using window method -- Header 00003 // 00004 // 2014/11/09, 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 }; 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 fc, float hk[]); 00032 00033 private: 00034 static const float PI_ = 3.1415926536f; 00035 const float FS_; // Sampling frequency 00036 const float PI_FS_; 00037 00038 float *hm_; // For coefficients 00039 float *wn_; // For Windwo 00040 00041 int order_; // Order 00042 float fC_; // Cutoff frequency 00043 00044 // Calculation of coefficients for LPF 00045 void LpfCoefficients(); 00046 // Transform LPF to HPF 00047 void ToHpf(); 00048 // Hamming window 00049 void HammWindow(); 00050 }; 00051 } 00052 #endif // HAMMING_WINDOWING_DESIGN_HPP
Generated on Wed Jul 20 2022 18:57:52 by
1.7.2