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 UIT_FFT_Real
Hamming.hpp
00001 //------------------------------------------------------------------- 00002 // Hamming windowing with zero-padding 00003 // 00004 // 2017/04/10, Copyright (c) 2017 MIKAMI, Naoki 00005 //------------------------------------------------------------------- 00006 00007 #ifndef HAMMING_WINDOW_HPP 00008 #define HAMMING_WINDOW_HPP 00009 00010 #include "mbed.h" 00011 #include "Array.hpp" 00012 00013 namespace Mikami 00014 { 00015 class HammingWindow 00016 { 00017 public: 00018 // Constructor 00019 HammingWindow(uint16_t nData, uint16_t nFft) 00020 : N_(nData), NFFT_(nFft), w_(nData) 00021 { 00022 float pi2L = 6.283185f/(float)nData; 00023 for (int k=0; k<nData; k++) 00024 w_[k] = 0.54f - 0.46f*cosf(k*pi2L); 00025 } 00026 00027 // Windowing 00028 void Execute(const float x[], float y[]) 00029 { 00030 for (int n=0; n<N_; n++) y[n] = x[n]*w_[n]; 00031 for (int n=N_; n<NFFT_; n++) y[n] = 0; 00032 } 00033 00034 private: 00035 const int N_; 00036 const int NFFT_; 00037 00038 Array<float> w_; 00039 00040 // disallow copy constructor and assignment operator 00041 HammingWindow(const HammingWindow& ); 00042 HammingWindow& operator=(const HammingWindow& ); 00043 }; 00044 } 00045 #endif // HAMMING_WINDOW_HPP
Generated on Tue Jul 12 2022 18:30:31 by
