Performs nFFT-point discrete Fourier Cosine transform. vSig will be padded with zeros if it has less than nFFT points and truncated if it has more.
int fft_cosine( 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_cosine_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 dsFCosine(wks, 2); // If all datasets are valid, then proceed if( dsData && dsFCosine ) { vector vec; vec = dsData; int nSize = vec.GetSize(); // Perform sine transform with exact size of signal int iRet = fft_cosine(nSize, vec); if(0 != iRet ) { printf("Forward FFT returned error: %d\n", iRet ); return; } // Store sine transform result dsFCosine = vec; } }
fft_sine
fft_utils.h