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
Fork of F746_Spectrogram by
Diff: MyClasses_Functions/AnalysisBase.cpp
- Revision:
- 0:9470a174c910
- Child:
- 2:1f092ac020e1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MyClasses_Functions/AnalysisBase.cpp	Sun May 22 06:28:40 2016 +0000
@@ -0,0 +1,34 @@
+//-------------------------------------------------------
+//  Base class for spectrum analysis
+//
+//  2016/05/14, Copyright (c) 2015 MIKAMI, Naoki
+//-------------------------------------------------------
+
+#include "AnalysisBase.hpp"
+
+namespace Mikami
+{
+    AnalyzerBase::AnalyzerBase(int nData, int nFft, int nUse)
+        : N_DATA_(nData), N_FFT_(nFft),
+          fft_(nFft), wHm_(nData-1, nUse),
+          xData_(new float[nUse]), wData_(new float[nUse]) {}
+
+    AnalyzerBase::~AnalyzerBase()
+    {
+        delete[] xData_;
+    }
+
+    void AnalyzerBase::Execute(const float xn[], float db[])
+    {
+        // Differencing
+        for (int n=0; n<N_DATA_-1; n++)
+            xData_[n] = xn[n+1] - 0.8f*xn[n];
+            
+        // Windowing (FFT, cepstrum: + zero-padding)
+        wHm_.Execute(xData_, wData_);
+            
+        // Pure virtual function for analyzing
+        Analyze(wData_, db);
+    }
+}
+
    