Signal Processing Toolbox | ![]() ![]() |
Syntax
A=
convmtx(c,n) A=
convmtx(r,n)
Description
A convolution matrix is a matrix, formed from a vector, whose inner product with another vector is the convolution of the two vectors.
A
where =
convmtx(c,n)
c
is a length m
column vector returns a matrix A
of size (m+n-1)
-by-n
. The product of A
and another column vector x
of length n
is the convolution of c
with x
.
A
where =
convmtx(r,n)
r
is a length m
row vector returns a matrix A
of size n
-by-(m+n-1)
. The product of A
and another row vector x
of length n
is the convolution of r
with x
.
Example
Generate a simple convolution matrix.
h =
[1 2 3 2 1];
convmtx(h,7)
ans =
1 2 3 2 1 0 0 0 0 0 0
0 1 2 3 2 1 0 0 0 0 0
0 0 1 2 3 2 1 0 0 0 0
0 0 0 1 2 3 2 1 0 0 0
0 0 0 0 1 2 3 2 1 0 0
0 0 0 0 0 1 2 3 2 1 0
0 0 0 0 0 0 1 2 3 2 1
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
Algorithm
convmtx
uses the function toeplitz
to generate the convolution matrix.
See Also
|
Convolution and polynomial multiplication. |
|
N-dimensional convolution (see the MATLAB documentation). |
|
Two-dimensional convolution. |
|
Discrete Fourier transform matrix. |
![]() | conv2 | corrcoef | ![]() |