Language Reference

DFCONV Function

DFCONV (u, v, <type>) ;

This function is supported by the IML procedure and the iml action.

The DFCONV function computes the convolution of two input vectors, u and v. Assuming that the length of vector u is M and the length of vector v is N, the convolution between these two vectors is defined as

y left-parenthesis k right-parenthesis equals sigma-summation Underscript j equals max left-parenthesis 1 comma k plus 1 minus upper N right-parenthesis Overscript min left-parenthesis k comma upper M right-parenthesis Endscripts u left-parenthesis j right-parenthesis v left-parenthesis k minus j plus 1 right-parenthesis

where k equals 1 comma 2 comma ellipsis comma upper M plus upper N minus 1.

In digital signal processing, convolution plays an important role. The output of a linear time-invariant digital filter, y left-parenthesis n right-parenthesis, is the full convolution of its impulse response, h left-parenthesis n right-parenthesis, with the input signal, x left-parenthesis n right-parenthesis.

The input arguments to the DFCONV function are as follows:

u

specifies the first input data vector. Any missing value in this vector is replaced with 0.

v

specifies the second input data vector. Any missing value in this vector is replaced with 0.

type

is an optional string that specifies the type of convolution to be computed. It is one of the following three values: "Full", "Same", or "Valid". The three types of convolution are defined as follows:

Full

is the full convolution, which outputs the results with length upper M plus upper N minus 1. This is the default type.

Same

is the same-size convolution, which outputs the central part of the full results with the same length as the first input vector, u.

Valid

is the valid convolution, which outputs only the results that are computed without the zero-padded samples. If the length of u is less than the length of v, then the output is empty.

The input type string is not case-sensitive. When it is not specified, a full convolution is computed.

The DFCONV function returns the convolution results, the length of which depends on the type of convolution specified.

The following example uses the DFCONV function to convolute two vectors:

u = {1, 0, 3, 5, 2};
v = {6, 3, 5};
conv_type = "full";

y = dfconv(u, v, conv_type);
print y;

Figure 104: Convolution Results of Two Vectors

y
6
3
23
39
42
31
10


Last updated: July 20, 2026