CONV

Purpose:

Computes the convolution of two series in the time domain.

Syntax:

CONV(series1, series2, start, length, interval, "shape")

series1

-

A series.

series2

-

A series.

start

-

Optional. An integer, the starting point. Defaults to the first point of the series.

length

-

Optional. An integer, the number of points to process. Defaults to length(series1) + length(series2) - start.

interval

-

Optional. An integer, the convolution interval. Defaults to 1.

"shape"

 -

Optional. A string, the output shape flag. Valid options:

"full"

:

full convolution output (default)

"same"

:

output is a section of the same size as series1

"valid"

:

output only includes values not computed with zero-padding

Returns:

A series or table.

Example:

conv({3, 1, 1}, {2, 1})

 

Yields the series {6, 5, 3, 1} producing the coefficients of the following polynomial multiplication:

 

image\conv01.gif

Example:

conv(W1, reverse(W1))

 

yields the auto-correlation of the series in W1.

Example:

W1: gnorm(1000,1)

W2: rev(w1)

W3: conv(W1, W2)

W4: conv(W1, W2, 900, 200)

 

image\convpic.png

 

W3 contains the raw auto-correlation of W1.

 

W4 starts calculating the convolution when the first point in W2 reaches the 900th point of W1 (start point), and continues calculating until 200 points have been processed. The resulting series length is 200. In this example, the resulting series is a 200 point window around the mid point of the full auto-correlation.

 

Example:

W1: {1, -3, 4}

W2: {6, 7, 2, 5, 3, 1, 4}

W3: conv(w1, w2)

W4: conv(w2, w1)

W5: conv(w1, w2, "same")

W6: conv(w2, w1, "same")

W7: conv(w1, w2, "valid")

W8: conv(w2, w1, "valid")

 

W3 == {6, -11, 5, 27, -4, 12, 13, -8, 16}

W4 == {6, -11, 5, 27, -4, 12, 13, -8, 16}

 

W5 == {27, -4, 12}

W6 == {-11, 5, 27, -4, 12, 13, -8}

 

W7 == {}

W8 == {5, 27, -4, 12, 13}

 

 

W3 and W4 perform "full" convolution by default. The order of the input series does not matter.

 

W5 and W6 produce "same" convolution where the output is the central part of the full convolution with the same length as the first input series as shown in red:

 

{6, -11, 5, 27, -4, 12, 13, -8, 16}

{6, -11, 5, 27, -4, 12, 13, -8, 16}

 

W7 and W8 perform "valid" convolution where the output contains values that were not zero padded at the start and end edges as shown in red:

 

{}

{6, -11, 5, 27, -4, 12, 13, -8, 16}

 

Remarks:

The discrete convolution of series x[n] and h[n] is defined as:

 

image\conv02.gif

 

CONV computes convolution directly in the time domain and is optimized for real data. Use FCONV to perform convolution via the Fourier Transform method.

 

By default, the resulting series contains length(series1) + length(series2) - 1 data points.

 

If start <= 0, start defaults to 1.

 

If length <= 0, length defaults to length(series1) + length(series2) - start

 

When specified, the start and length parameters override the shape parameter.

 

As demonstrated by the first example, convolution is equivalent to polynomial multiplication where the terms of the polynomials are arranged in descending powers.

 

See DECONV to deconvolve two series.

See Also:

AUTOCOR

CIRCONV

CONV2D

CROSSCOR

DECONV

FCONV

FDECONV

FFT

FILTEQ

XCORR

References:

Oppenheim and Schafer.

Digital Signal Processing

Prentice Hall, 1975

 

Digital Signal Processing Committee

Programs for Digital Signal Processing

I.E.E.E. Press, 1979