LabWindows/CVI

Content Type
Programming Language
Current manual
Table of Contents

ConvolveEx

Advanced Analysis Library Only

AnalysisLibErrType ConvolveEx (double arrayX[], ssize_t sizeOfX, double arrayY[], ssize_t sizeOfY, int algorithm, double outputArray[]);

Purpose

Finds the convolution of the input arrays. National Instruments recommends that you use this function instead of Convolve. ConvolveEx includes an additional parameter, algorithm, which makes it more versatile than Convolve.

The linear convolution of the signals x(t) and y(t) is defined as follows:


where the symbol * denotes linear convolution.

When algorithm is ALGORITHM_CONCOR_DIRECT, this function uses the following equation to perform the discrete implementation of the linear convolution and obtain the elements of arrayX * arrayY.



for i = 0, 1, 2, ..., M+N–2

where h is arrayX * arrayY

N is the number of elements in arrayX

M is the number of elements in arrayY

the indexed elements outside the ranges of arrayX and arrayY are equal to zero, as shown in the following relationships:

xj = 0, j < 0, or jN

and

yj = 0, j < 0, or jM

Note Note  This formula description assumes that MN. For M > N, exchange (x, y) and (M, N) in the previous equations.
When algorithm is ALGORITHM_CONCOR_FREQ_DOMAIN, this function completes the following steps, in order, to compute the linear convolution:

  1. First, this function pads the end of arrayX and arrayY with zeros to make their lengths M + N – 1, as shown in the following equations.


  2. Second, this function calculates the Fourier transform of arrayX' and arrayY' according to the following equations.

    arrayX'(f) = FFT(x')

    arrayY'(f) = FFT(y')
  3. Third, this function multiplies arrayX'(f) by arrayY'(f) and calculates the inverse Fourier transform of the product. The result is the linear convolution of arrayX and arrayY, as shown in the following equation.

    arrayX * arrayY = IFFT(arrayX'(f) ⋅ arrayY'(f))

    Thus, this function computes the linear convolution, not the circular convolution. However, because x(t) * y(t)nX(f)Y(f) is a Fourier transform pair, where x(t) * y(t)n is the circular convolution of x(t) and y(t), you can create a circular version of the convolution.

Note Note  This function temporarily allocates memory for use as a work area. If ConvolveEx cannot allocate memory, the function returns an error code.

Parameters

Input
Name Type Description
arrayX double [] First input array.
sizeOfX ssize_t Number of elements in arrayX.
arrayY double [] Second input array.
sizeOfY ssize_t Number of elements in arrayY.
algorithm int Specifies the convolution method to use. algorithm must be one of the following values. Note that slight numerical differences can exist between the two methods.

Constant Value Description
ALGORITHM_CONCOR_DIRECT 0 Computes the convolution using the direct method of linear convolution. If arrayX and arrayY are small, the ALGORITHM_CONCOR_DIRECT convolution method is typically faster.
ALGORITHM_CONCOR_FREQ_DOMAIN 1 Computes the convolution using an FFT-based technique. If arrayX and arrayY are large, the ALGORITHM_CONCOR_FREQ_DOMAIN convolution method is typically faster.
Output
Name Type Description
outputArray double [] Convolution array. This array must be at least (N + M – 1) elements long.

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 9.0 and later

Was this information helpful?

Previous

Convolve

Previous

Convolve

Log in to get a better experience

Help us improve your future ni.com experience.

What are you trying to do?

Submit