Performs Short-Time-Fourier-Transform on a 1d signal(complex data).
int stft_complex( vector<complex> & vSignal, vector & vWin, double dSmplIntv, int nOverlap, int nFFTPts, matrix<complex> & matSTFT, matrix & matAmp, double & dScaleTime, double & dScaleFreq )
0 for success or error codes.
Prior to compilation, load fftEx_utils.c to the workspace by executing the following LabTalk command:
Run.LoadOC("Originlab\fftEx_utils.c", 16);
To retain fftEx_utils.c in the workspace for successive sessions, drag and drop the file from the Temporary folder to the System folder.
EX1
#include <Origin.h> #include <fft_utils.h> #include <fftEx_utils.h> void stft_complex_ex1() { vector win(4); vector sig_re(8) = {0, 0, 0, 1, 1, 0, 0, 0}; vector sig_im(8) = {0, 0, 0, 1, 1, 1, 0, 0}; vector<complex> sig(8); sig.MakeComplex(sig_re, sig_im); get_window_data(RECTANGLE_WIN, 4, win); matrix<complex> stft; matrix amp; double stime; double sfreq; stft_complex(sig, win, 0.1, 1, 4, stft, amp, stime, sfreq); int row = stft.GetNumRows(); int col = stft.GetNumCols(); for (int ii=0; ii<row; ii++) { for (int jj=0; jj<col; jj++) printf ("%lf+%lfi\t", stft[ii][jj].m_re, stft[ii][jj].m_im); printf ("\n"); } }
fftEx_utils.h