2.1.22.2.2.7 fft_filter_window


Description

Create the window function for fft filtering

Syntax

int fft_filter_window(int iSize, int iType, double *vWindow, double dFc1, double dFc2, double dFreqStep, BOOL bAddOffset);

Parameters

iSize

[input]: the number of data values in the window function.

iType

[input]: the type of the filter, it should be one of the following values

iType = LOW_PASS_FILTERING, low-pass filtering;
iType = HIGH_PASS_FILTERING, high-pass filtering;
iType = BAND_PASS_FILTERING, band-pass filtering;
iType = BAND_BLOCK_FILTERING, band-block filtering;
iType = LOW_PASS_PARABOLIC_FILTERING, low-pass parabolic filtering
vWindow

[Output]: the created window sequence.

dFc1

[input]: the lower bound of the frequency

dFc2

[input]: the upper bound of the frequency.

dFreqStep

[input]: the frequency interval of the window function.

bAddOffset

[input]: specify whether to add the DC offset.

Return

Returns 0 for success or error codes for failure.

Examples

EX1

//Assume the current Worksheet exists and has 1 column. This piece of code creates a
//filter window then output the result into the worksheet.

#include <..\originlab\fft.h>	
void fft_filter_window_ex1()
{
	int n=256, success, iType=2;
	double dFc1=50, dFc2=100, dFreqStep=1.0;
			
	Worksheet wks = Project.ActiveLayer();
	if(wks)
	{
		Dataset ww(wks, 0);
	
		vector w(n);
				
		success = fft_filter_window(n, iType, w, dFc1, dFc2, dFreqStep, false);
		ww = w;
	}
}

Remark

Create the window function for fft filtering. dFc1 and dFc2 contain the lower and upper frequency bound where dFc1<=dFc2. dFc1 is ignored in lowpass filtering and dFc2 is ignored in highpass filtering.

See Also

Header to Include

fft.h

Reference