Main Content

toeplitz

Toeplitz matrix

Description

T = toeplitz(c,r) returns a nonsymmetric Toeplitz matrix with c as its first column and r as its first row. If the first elements of c and r differ, toeplitz issues a warning and uses the column element for the diagonal.

example

T = toeplitz(r) returns the symmetric Toeplitz matrix where:

  • If r is a real vector, then r defines the first row of the matrix.

  • If r is a complex vector with a real first element, then r defines the first row and r' defines the first column.

  • If the first element of r is complex, the Toeplitz matrix is Hermitian off the main diagonal, which means Ti,j=conj(Tj,i) for ij. The elements of the main diagonal are set to r(1).

example

Examples

collapse all

r = [1 2 3];
toeplitz(r)
ans = 3×3

     1     2     3
     2     1     2
     3     2     1

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.

c = [1  2  3 4];
r = [4 5 6];
toeplitz(c,r)
Warning: First element of input column does not match first element of input row. 
         Column wins diagonal conflict.
ans = 4×3

     1     5     6
     2     1     5
     3     2     1
     4     3     2

Create a Toeplitz matrix with complex row and column vectors.

c = [1+3i 2-5i -1+3i];
r = [1+3i 3-1i -1-2i];
T = toeplitz(c,r)
T = 3×3 complex

   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.

v = [9 1 3 2];
toeplitz([v(1) fliplr(v(2:end))], v)
ans = 4×4

     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.

x = [1 8 3 2 5];
h = [3 5 2 4 1];

Form the column vector c to create a circulant matrix where length(c) = length(h).

c = [x(1) fliplr(x(end-length(h)+2:end))]
c = 1×5

     1     5     2     3     8

Form the row vector r from x.

r = x;

Form the convolution matrix xConv using toeplitz. Find the convolution using h*xConv.

xConv = toeplitz(c,r)
xConv = 5×5

     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

h*xConv
ans = 1×5

    52    50    73    46    64

If you have the Signal Processing Toolbox™, you can use the cconv (Signal Processing Toolbox) 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.

x = [1 8 3 2 5];
h = [3 5 2];

Form r by padding x with zeros. The length of r is the convolution length x + h - 1.

r = [x zeros(1,length(h)-1)]
r = 1×7

     1     8     3     2     5     0     0

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.

c = [x(1) zeros(1,length(h)-1)]
c = 1×3

     1     0     0

Form the convolution matrix xConv using toeplitz. Then, find the convolution using h*xConv.

xConv = toeplitz(c,r)
xConv = 3×7

     1     8     3     2     5     0     0
     0     1     8     3     2     5     0
     0     0     1     8     3     2     5

h*xConv
ans = 1×7

     3    29    51    37    31    29    10

Check that the result is correct using conv.

conv(x,h)
ans = 1×7

     3    29    51    37    31    29    10

Input Arguments

collapse all

Column of Toeplitz matrix, specified as a scalar or vector. If the first elements of c and r differ, toeplitz uses the column element for the diagonal.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64
Complex Number Support: Yes

Row of Toeplitz matrix, specified as a scalar or vector. If the first elements of c and r differ, then toeplitz uses the column element for the diagonal.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64
Complex Number Support: Yes

More About

collapse all

Toeplitz Matrix

A Toeplitz matrix is a diagonal-constant matrix, which means all elements along a diagonal have the same value. For a Toeplitz matrix A, we have Ai,j = ai–j which results in the form

A=[a0a1a2a1na1a0a1a2a1a0a2a0a1an1a2a1a0].

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a

See Also

|