convmtx

Convolution matrix

Syntax

A = convmtx(h,n)

Description

A convolution matrix is a matrix, formed from a vector, whose product with another vector is the convolution of the two vectors.

A = convmtx(h,n) returns the convolution matrix, A, such that the product of A and a vector, x, is the convolution of h and x. If h is a column vector of length m, A is (m+n-1)-by-n and the product of A and a column vector, x, of length n is the convolution of h and x. If h is a row vector of length m, A is n-by-(m+n-1) and the product of a row vector, x, of length n with A is the convolution of h and x.

Examples

Generate a simple convolution matrix:

h = [1 2 3 2 1];
convmtx(h,7);

Note that convmtx handles edge conditions by zero padding.

In practice, it is more efficient to compute convolution using

y = conv(c,x);

than by using a convolution matrix.

n = length(x);
y = convmtx(c,n)*x;

More About

expand all

Algorithms

convmtx uses the function toeplitz to generate the convolution matrix.

See Also

| | |

Was this topic helpful?