LabWindows/CVI

Content Type
Programming Language
Current manual

CxScaledWindow

CxScaledWindow

Advanced Analysis Library Only

AnalysisLibErrType CxScaledWindow (NIComplexNumber xArray[], ssize_t numberOfElements, int windowType, double windowParameter, WindowConst *windowConstants);

Purpose

Applies a scaled window to a complex signal.

This function scales the result so that when the power or amplitude spectrum of the windowed waveform is computed, all windows provide the same level within the accuracy constraints of the window. ScaledWindowEx also returns important window constants for the selected window. These constants are useful when you use functions that perform computations on the power spectrum, such as PowerFrequencyEstimate and SpectrumUnitConversion.

for i = 0, 1, 2, ...

where wi and cg are the coefficients and coherent gain of the window without scaling, respectively.

This function also returns the coherent gain (CG) and equivalent noise bandwidth (ENBW) of the selected window. For cosine windows, these two properties are constants, as listed in the following table.

Window Type Window Properties
CG ENBW
Rectangle 1.0 1.0
Hanning 0.5 1.5
Hamming 0.54 1.362826
Blackman-Harris 0.42323 1.708538
Exact Blackman 0.42659071367 1.693699
Blackman 0.42 1.726757
Flat Top 0.215578948 3.770246506303
4 Term B-Harris 0.35875 2.004353
7 Term B-Harris 0.27105140069342415 2.631905
Low Sidelobe 0.323215218 2.215350782519
Blackman Nuttall 0.3635819 1.9761117

If xArray is an empty input array and the selected window is a cosine window, this function returns the window properties. If xArray is an empty input array and the selected window is not a cosine window, this function sets the window properties to NaN and returns an error. For Triangle, Kaiser, Dolph-Chebyshev, and Gaussian windows, the window properties depend on the window length and the window parameters.

Parameters

Input
Name Type Description
numberOfElements ssize_t The number of elements in xArray.
windowType int The type of window to apply. Specify one of the following values:

Window Type Constant Value
Rectangle RECTANGLE 0
Hanning HANNING 1
Hamming HAMMING 2
Blackman-Harris BLKHARRIS 3
Exact Blackman EXBLKMAN 4
Blackman BLKMAN 5
Flat Top FLATTOP 6
4-Term Blackman-Harris BH4TERM 7
7-Term Blackman-Harris BH7TERM 8
Lowside LB LOWSIDELB 9
Blackman-Nuttall BLKMANNUTTAL 11
Triangle TRIANGLE 30
Barthann BARTHANN 31
Bohman BOHMAN 32
Parzen PARZEN 33
Welch WELCH 34
Kaiser KAISER 60
Dolph-Chebyshev DOLCHEBYSHEV 61
Gaussian GAUSSIAN 62
windowParameter double The window parameter. This parameter is referenced only if windowType is one of the following values:
  • KAISER: windowParameter specifies the beta parameter for a Kaiser window.
  • GAUSSIAN: windowParameter specifies the standard deviation for a Gaussian window. If windowParameter < 0, the function uses 0.2 for windowParameter instead.
  • DOLCHEBYSHEV: windowParameter specifies the ratio of the mainlobe to the sidelobe, in dB, for a Dolph-Chebyshev window. If windowParameter < 0, the function uses 60dB for windowParameter instead.
Output
Name Type Description
xArray NIComplexNumber [] On input, the input signal.

On output, this parameter returns the input signal with the selected window applied.
windowConstants WindowConst Pointer to a structure that contains the following useful constants for the selected window:
  • enbw is the equivalent noise bandwidth of the selected window. You can use this value to calculate the power in a given frequency span.
  • coherentgain is the peak gain of the window, relative to the peak gain of the Rectangular window. ScaledWindowEx uses this value to normalize peak gains to those of the Rectangular window.

WindowConst is defined by the following C typedef statement:
typedef struct {
double enbw;
double coherentgain;
} WindowConst;

Return Value

Name Type Description
status AnalysisLibErrType A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.

Additional Information

Library: Advanced Analysis Library

Include file: analysis.h

LabWindows/CVI compatibility: LabWindows/CVI 2012 and later

Example

Refer to analysis\cxwindowing.cws for an example of using the CxScaledWindow function.

Was this information helpful?