Symbolic Toeplitz matrix
toeplitz(
generates a
nonsymmetric Toeplitz matrix having
c
,r
)c
as its first column and r
as its first row. If
the first elements of c
and r
are different,
toeplitz
issues a warning and uses the first element of the
column.
toeplitz(
generates a symmetric Toeplitz
matrix if r
)r
is real. If r
is complex, but its
first element is real, then this syntax generates the Hermitian Toeplitz matrix formed from
r
. If the first element of r
is not real, then
the resulting matrix is Hermitian off the main diagonal, meaning that Tij = conjugate(Tji) for i ≠ j.
Generate the Toeplitz matrix from these vectors. Because these vectors are not symbolic objects, you get floating-point results.
c = [1 2 3 4 5 6]; r = [1 3/2 3 7/2 5]; toeplitz(c,r)
ans = 1.0000 1.5000 3.0000 3.5000 5.0000 2.0000 1.0000 1.5000 3.0000 3.5000 3.0000 2.0000 1.0000 1.5000 3.0000 4.0000 3.0000 2.0000 1.0000 1.5000 5.0000 4.0000 3.0000 2.0000 1.0000 6.0000 5.0000 4.0000 3.0000 2.0000
Now, convert these vectors to a symbolic object, and generate the Toeplitz matrix:
c = sym([1 2 3 4 5 6]); r = sym([1 3/2 3 7/2 5]); toeplitz(c,r)
ans = [ 1, 3/2, 3, 7/2, 5] [ 2, 1, 3/2, 3, 7/2] [ 3, 2, 1, 3/2, 3] [ 4, 3, 2, 1, 3/2] [ 5, 4, 3, 2, 1] [ 6, 5, 4, 3, 2]
Generate the Toeplitz matrix from this vector:
syms a b c d T = toeplitz([a b c d])
T = [ a, b, c, d] [ conj(b), a, b, c] [ conj(c), conj(b), a, b] [ conj(d), conj(c), conj(b), a]
If you specify that all elements are real, then the resulting Toeplitz matrix is symmetric:
syms a b c d real T = toeplitz([a b c d])
T = [ a, b, c, d] [ b, a, b, c] [ c, b, a, b] [ d, c, b, a]
For further computations, clear the assumptions by recreating the variables using
syms
:
syms a b c d
Generate the Toeplitz matrix from a vector containing complex numbers:
T = toeplitz(sym([1, 2, i]))
T = [ 1, 2, 1i] [ 2, 1, 2] [ -1i, 2, 1]
If the first element of the vector is real, then the resulting Toeplitz matrix is Hermitian:
isAlways(T == T')
ans = 3×3 logical array 1 1 1 1 1 1 1 1 1
If the first element is not real, then the resulting Toeplitz matrix is Hermitian off the main diagonal:
T = toeplitz(sym([i, 2, 1]))
T = [ 1i, 2, 1] [ 2, 1i, 2] [ 1, 2, 1i]
isAlways(T == T')
ans = 3×3 logical array 0 1 1 1 0 1 1 1 0
Generate a Toeplitz matrix using these vectors to specify the
first column and the first row. Because the first elements of these
vectors are different, toeplitz
issues a warning
and uses the first element of the column:
syms a b c toeplitz([a b c], [1 b/2 a/2])
Warning: First element of given column does not match first element of given row. Column wins diagonal conflict. ans = [ a, b/2, a/2] [ b, a, b/2] [ c, b, a]
Calling toeplitz
for numeric arguments
that are not symbolic objects invokes the MATLAB® toeplitz
function.