CONVOL1D Function

Computes the discrete convolution of two sequences.

Usage

result = CONVOL1D(x, y)

Input Parameters

x—A one-dimensional array.

y—A one-dimensional array.

Returned Value

result—A one-dimensional array containing the discrete convolution of x and y.

Keywords

Direct—If set, the computation is performed using the direct method rather than the FFT method, regardless of the size of the arrays.

Periodic—If present and nonzero, a circular convolution is computed.

Discussion

The function CONVOL1D computes the discrete convolution of two sequences x(k) and y(k) given by:

 

The values of x(n) and y(kn) are assumed to be zero when the index is not between [0, Nx – 1] and [0, Ny – 1], respectively.

If the lengths of the sequences are small, the direct sum formula is used. Otherwise, for longer sequences the FFT is used to compute the convolution.

Example

In this example, the convolution of x = [1, 2, 3, 2, 1] and y = [2, 2, 2] is computed.

; Define x and y.
x = [1, 2, 3, 2, 1]
y = [2, 2, 2]
PM, CONVOL1D(x, y)

This results in the following output:

2.0000000
6.0000000
12.000000
14.000000
12.000000
6.0000000
2.0000000