Performs nFFT-point discrete Fourier Sine transform. vSig will be padded with zeros if it has less than nFFT points and truncated if it has more.
int fft_sine( int nFFT, vector & vSig )
Returns OE_NOERROR for success or error codes for failure.
Prior to compilation, load fft_utils.c to the workspace by executing the following LabTalk command:
Run.LoadOC("Originlab\fft_utils.c", 16);
To retain fft_utils.c in the workspace for successive sessions, drag and drop the file from the Temporary folder to the System folder.
EX1
#include <fft_utils.h> void fft_sine_ex1() { // This example assumes a worksheet is active with three columns, where // column 2 has the signal. Column 3 will be filled with Fourier Sine // transform result. Worksheet wks = Project.ActiveLayer(); Dataset dsData(wks, 1); Dataset dsFSine(wks, 2); // If all datasets are valid, then proceed if( dsData && dsFSine ) { vector vec; vec = dsData; int nSize = vec.GetSize(); // Perform sine transform with exact size of signal int iRet = fft_sine(nSize, vec); if(0 != iRet ) { printf("Forward FFT returned error: %d\n", iRet ); return; } // Store sine transform result dsFSine = vec; } }
fft_cosine
fft_utils.h