Apply a window to a sequence with shift, then get a new sequence of result. Pay atention the start position is not at 0, but at ishift.
int fft_apply_window( int iSigSize, double * vSig, int iWinSize, double * vWindow, int iShift, int iResultSize, double * vResult, int iPadding, int iStep )
returns 0 for success.
returns INVALID_SIZE data size maybe incorrect.
returns UNKNOWN_ERROR Memory Error.
EX1
//Assume in the current worksheet, the first is signal sequence, the second is the window data to be applied. #include <..\originlab\fft.h> void TEST_fft_apply_window() { Worksheet wks = Project.ActiveLayer(); if(wks) { Dataset dsSig(wks, 0); Dataset dsWin(wks, 1); vector vecSig, vecWin, vecResult; int iSigSize, iWinSize, iShift, iPadding; vecSig = dsSig; vecWin = dsWin; iSigSize = vecSig.GetSize(); iWinSize = vecWin.GetSize(); iShift = 5; //specify a number just as you wish iPadding = 10; int iSteps = iSigSize/iShift; int iResultSize = iSteps * (iWinSize+iPadding); vecResult.SetSize(iResultSize); int ret = fft_apply_window(iSigSize, vecSig, iWinSize, vecWin, iShift, iResultSize, vecResult, iPadding, iSteps); if (ret != 0) out_str("Fail call"); } }
fft.h