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:
2015-10-29
Revision:
1:559a63853f3f
Parent:
0:982a9acf3a07
Child:
2:9649d0e2bb4a

File content as of revision 1:559a63853f3f:

//-------------------------------------------------------------------
// FFT class for real data ---- Header
//      This class can execute FFT and IFFT 
// Copyright (c) 2015 MIKAMI, Naoki,  2015/10/29
//-------------------------------------------------------------------

#ifndef FFT_REAL_HPP
#define FFT_REAL_HPP

#include "mbed.h"
#include <complex>  // requisite for complex

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

    class FftReal
    {
    private:
        const int   N_FFT_;
        const float N_INV_;
        
        Complex*    wTable_;    // twiddle factor
        uint16_t*   bTable_;    // for bit reversal
        Complex*    u_;         // working area

        // Processing except for last stage
        void ExcludeLastStage();
        // Use for reordering of rit reversal in IFFT
        int Index(int n) { return (N_FFT_-bTable_[n]); }

        FftReal(const FftReal& );
        FftReal& operator=(const FftReal& );

    public:
        // Constructor
        explicit FftReal(int16_t n);
        // Destructor
        ~FftReal();
        // Execute FFT
        void Execute(const float x[], Complex y[]);
        // Execute IFFT
        void ExecuteIfft(const Complex y[], float x[]);
    };
}
#endif  // FFT_REAL_HPP