不韋 呂 / Mbed 2 deprecated F746_SpectralAnalysis_NoPhoto

Dependencies:   BSP_DISCO_F746NG BUTTON_GROUP LCD_DISCO_F746NG TS_DISCO_F746NG UIT_FFT_Real mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers FFT_Analysis.hpp Source File

FFT_Analysis.hpp

00001 //-------------------------------------------------------
00002 // Class for spectrum analysis using FFT (Header)
00003 // Copyright (c) 2015 MIKAMI, Naoki,  2015/10/26
00004 //-------------------------------------------------------
00005 
00006 #ifndef FFT_ANALYZER_HPP
00007 #define FFT_ANALYZER_HPP
00008 
00009 #include "fftReal.hpp"
00010 #include "Hamming.hpp"
00011 
00012 namespace Mikami
00013 {
00014     class FftAnalyzer
00015     {
00016     public:
00017         FftAnalyzer(int nData, int nFft);
00018         ~FftAnalyzer();
00019         void Execute(float xn[], float db[]);
00020 
00021     private:
00022         const int N_DATA_;
00023         const int N_FFT_;
00024 
00025         HammingWindow hm_;
00026         FftReal fft_;
00027 
00028         float* xData;   // Data to be analyzed
00029         float* xFft;    // Input for FFT
00030         Complex* yFft;  // Output of FFT
00031         float* normY;   // Powerspectrum
00032 
00033         float Sqr(float x) { return x*x; }
00034     };
00035 }
00036 
00037 #endif  // FFT_ANALYZER_HPP
00038