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: BSP_DISCO_F746NG BUTTON_GROUP LCD_DISCO_F746NG TS_DISCO_F746NG UIT_FFT_Real mbed
MyClasses/AnalysisBase.cpp
- Committer:
- MikamiUitOpen
- Date:
- 2016-02-22
- Revision:
- 18:6630d61aeb3c
- Parent:
- 4:99d4d5ea06a2
File content as of revision 18:6630d61aeb3c:
//-------------------------------------------------------
// Base class for spectrum analysis
//
// 2015/12/15, 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] - xn[n];
// Windowing (FFT, cepstrum: + zero-padding)
wHm_.Execute(xData_, wData_);
// Pure virtual function for analyzing
Analyze(wData_, db);
}
}