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/FFT_Analysis.cpp
- Committer:
- MikamiUitOpen
- Date:
- 2015-12-14
- Revision:
- 3:7c26b701f363
- Parent:
- 2:095b360e0f54
- Child:
- 4:99d4d5ea06a2
File content as of revision 3:7c26b701f363:
//------------------------------------------------------- // Class for spectrum analysis using FFT // // 2015/12/14, Copyright (c) 2015 MIKAMI, Naoki //------------------------------------------------------- #include "FFT_Analysis.hpp" namespace Mikami { FftAnalyzer::FftAnalyzer(int nData, int nFft) : AnalyzerBase(nData, nFft, nFft), xFft_(new float[nFft]), yFft_(new Complex[nFft/2+1]) {} FftAnalyzer::~FftAnalyzer() { delete[] xFft_; delete[] yFft_; } void FftAnalyzer::Analyze(const float xn[], float yn[]) { wHm_.Execute(xn, xFft_); // Windowing and zero-padding fft_.Execute(xFft_, yFft_); // Execute FFT // Translate to dB for (int n=0; n<=N_FFT_/2; n++) yn[n] = 10.0f*log10f(Norm(yFft_[n])); } }