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
AnalysisBase.hpp
00001 //------------------------------------------------------- 00002 // Base abstract class for spectrum analysis (Header) 00003 // 00004 // 2017/03/30, Copyright (c) 2017 MIKAMI, Naoki 00005 //------------------------------------------------------- 00006 00007 #ifndef BASE_ANALYZER_HPP 00008 #define BASE_ANALYZER_HPP 00009 00010 #include "Array.hpp" 00011 #include "fftReal.hpp" 00012 #include "Hamming.hpp" 00013 00014 namespace Mikami 00015 { 00016 class AnalyzerBase 00017 { 00018 public: 00019 // nData: Number of data to be analyzed 00020 // nFft: Number of FFT points 00021 // nUse: FFT, cepstrum: window width + zero padding 00022 // Linear prediction: window width 00023 AnalyzerBase(int nData, int nFft, int nUse); 00024 virtual ~AnalyzerBase() {} 00025 void Execute(const float xn[], float db[]); 00026 00027 protected: 00028 const int N_DATA_; 00029 const int N_FFT_; 00030 00031 FftReal fft_; 00032 00033 float Norm(Complex x) 00034 { return x.real()*x.real() + x.imag()*x.imag(); } 00035 00036 private: 00037 HammingWindow wHm_; 00038 00039 Array<float> xData_; // data to be analyzed 00040 Array<float> wData_; // windowd data 00041 00042 virtual void Analyze(const float wData[], float db[]) = 0; 00043 00044 // disallow copy constructor and assignment operator 00045 AnalyzerBase(const AnalyzerBase& ); 00046 AnalyzerBase& operator=(const AnalyzerBase& ); 00047 }; 00048 } 00049 #endif // BASE_ANALYZER_HPP 00050
Generated on Tue Jul 12 2022 18:30:30 by
