【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.1.22.2.1.1 apply_window_data
Contents
Description
Apply window to the signal.
Syntax
int apply_window_data( vector & vSignal, int nType, double * pdCom = NULL )
Parameters
- vSignal
- [modify] the original signal to be transformed, and the result of the transform.
- nType
- [input] the window method, now it can be one of the following,
- Rectangle_Win, Create a Rectangle Window
- Welch_Win, Create a Welch Window
- Triangular_Win, Create a Triangular Window
- Bartlett_Win, Create a Bartlett Window
- Hanning_Win, Create a Hanning Window
- Hamming_Win, Create a Hamming Window
- Blackman_Win, Create a Blackman Window
- Gaussian_Win, Create a Gaussian Window
- Kaiser_Win, Create a Kaiser Window
- pdCom
- [output] pointer to a data who will compensate the tapering caused by applying window in FFT
Return
Returns OE_NOERROR for success or error codes for failure.
Examples
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 apply_window_data_ex1() { //enum { // Window method //Rectangle_Win = 0, //Welch_Win, //Triangular_Win, //Bartlett_Win, //Hanning_Win, //Hamming_Win, //Blackman_Win, //Gaussian_Win, //Kaiser_Win, //}; int nType = 1; // Create a new worksheet and import data WorksheetPage wpg; wpg.Create("Origin"); Worksheet wks = wpg.Layers(0); string strFile = GetAppPath(TRUE) + "Samples\\Signal Processing\\Signal with Discrete Frequencies.dat"; ASCIMP ascimp; wks.GetASCIMP(ascimp); if( 0 != wks.ImportASCII(strFile, ascimp) ) { out_str("Failed to import file"); return; } // Add another column for convolution output uint nIndex = wks.AddCol(); wks.Columns(nIndex).SetLongName("ApplyWindow"); // Set up datasets and vectors for function call Dataset dsSignal(wks, 1); Dataset dsResult(wks, 2); vector vecSignal(dsSignal), vecResult; vecResult = vecSignal; // apply window to the signal int iRet = apply_window_data(vecResult, nType); if( 0 != iRet ) { printf("apply_window_data function returned error: %d\n", iRet); return; } // Copy result to dataset dsResult = vecResult; }
Remark
See Also
Header to Include
fft_utils.h