FFT for real data using decimation-in-frequency algorithm. 実データに対するFFT.周波数間引きアルゴリズムを使用. このライブラリを登録した際のプログラム: Demo_FFT_IFFT

Dependents:   UIT2_SpectrumAnalyzer F746_SpectralAnalysis_NoPhoto F746_FFT_Speed F746_RealtimeSpectrumAnalyzer ... more

fftReal.hpp

Committer:
MikamiUitOpen
Date:
2020-01-13
Revision:
3:dc123081d491
Parent:
2:9649d0e2bb4a
Child:
4:0b4975fffc90

File content as of revision 3:dc123081d491:

//-------------------------------------------------------------------
//  データが実数の場合の FFT class(ヘッダ)
//
//  2020/01/13, Copyright (c) 2020 MIKAMI, Naoki
//-------------------------------------------------------------------

#ifndef FFT_REAL_HPP
#define FFT_REAL_HPP

#include "mbed.h"
#include <complex>      // complex で使用
#include "Array.hpp"    // "Array_Matrix" という名前で Mbed に登録

namespace Mikami
{
    typedef complex<float> Complex; // define "Complex"

    class FftReal
    {
    public:
        // コンストラクタ
        explicit FftReal(int16_t n);
        // FFT の実行
        void Execute(const float x[], Complex y[]);
        // IFFT の実行
        void ExecuteIfft(const Complex y[], float x[]);

    private:
        const int   N_FFT_;
        const float N_INV_;
        Array<Complex>    wTable_;  // 回転子
        Array<uint16_t>   bTable_;  // ビット逆順
        Array<Complex>    u_;       // 作業領域

        // 最終ステージを除いた処理
        void ExcludeLastStage();
        // IFFT の美と逆順の並べ替えで使用
        int Index(int n) { return (N_FFT_-bTable_[n]); }

        // コピー・コンストラクタおよび代入演算子の禁止のため
        FftReal(const FftReal& );
        FftReal& operator=(const FftReal& );
    };
}
#endif  // FFT_REAL_HPP