fft_apply_window

 

Description

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.

Syntax

int fft_apply_window( int iSigSize, double * vSig, int iWinSize, double * vWindow, int iShift, int iResultSize, double * vResult, int iPadding, int iStep )

Parameters

iSigSize
[input] number of data values in the source sequency.
vSig
[input] source sequency
iWinSize
[input] size of window to be applied
vWindow
[input] window sequency
iShift
[input] shift of window per step
iResultSize
[output] the size of the vResult
vResult
[output] result sequency
iPadding
[input] number of paddings (0)
iStep
[input] number of total shift steps

Return

returns 0 for success.

returns INVALID_SIZE data size maybe incorrect.

returns UNKNOWN_ERROR Memory Error.

Examples

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");
    }
}

Remark

See Also

Header to Include

fft.h

Reference