Create a nonsymmetric Toeplitz matrix with a specified column and row vector. Because the first elements of the column and row vectors do not match, toeplitz
issues a warning and uses the column for the diagonal element.
Warning: First element of input column does not match first element of input
row.
Column wins diagonal conflict.
ans =
1 5 6
2 1 5
3 2 1
4 3 2
Create a Toeplitz matrix with complex row and column vectors. The Toeplitz matrix is Hermitian off the main diagonal such that
for
.
T =
1.0000 + 3.0000i 3.0000 - 1.0000i -1.0000 - 2.0000i
2.0000 - 5.0000i 1.0000 + 3.0000i 3.0000 - 1.0000i
-1.0000 + 3.0000i 2.0000 - 5.0000i 1.0000 + 3.0000i
You can create circulant matrices using toeplitz
. Circulant matrices are used in applications such as circular convolution.
Create a circulant matrix from vector v
using toeplitz.
ans =
9 1 3 2
2 9 1 3
3 2 9 1
1 3 2 9
Perform discrete-time circular convolution by using toeplitz
to form the circulant matrix for convolution.
Define the periodic input x
and the system response h
.
Form the column vector c
to create a circulant matrix where length(c) = length(h)
.
Form the row vector r
from x
.
Form the convolution matrix xConv
using toeplitz
. Find the convolution using h*xConv
.
xConv =
1 8 3 2 5
5 1 8 3 2
2 5 1 8 3
3 2 5 1 8
8 3 2 5 1
ans =
52 50 73 46 64
If you have the Signal Processing Toolbox™, you can use the cconv
function to find the circular convolution.
Perform discrete-time convolution by using toeplitz
to form the arrays for convolution.
Define the input x
and system response h
.
Form r
by padding x
with zeros. The length of r
is the convolution length x + h - 1
.
Form the column vector c
. Set the first element to x(1)
because the column determines the diagonal. Pad c
because length(c)
must equal length(h)
for convolution.
Form the convolution matrix xConv
using toeplitz
. Then, find the convolution using h*xConv
.
xConv =
1 8 3 2 5 0 0
0 1 8 3 2 5 0
0 0 1 8 3 2 5
ans =
3 29 51 37 31 29 10
Check that the result is correct using conv
.
ans =
3 29 51 37 31 29 10