toeplitz

Builds a Toeplitz matrix, with constant values along each diagonal.

Category: Mathematics > Elementary Math

Syntax

T = toeplitz(c)

Builds a symmetric Toeplitz matrix whose first column and first row are both c.

T = toeplitz(c, r)

Uses c as the first column and r as the first row.

Description

Entry T(i,j) equals c(i-j+1) on and below the main diagonal and r(j-i+1) above it, so every diagonal is constant. Toeplitz matrices describe discrete convolution and show up in autocorrelation and linear prediction problems.

With a single argument the result is symmetric, which makes toeplitz(c) convenient for building covariance-like matrices from a sequence of lags.

Input arguments

c
Vector with the first column of the matrix.
r
Vector with the first row. If r(1) differs from c(1), the value in c is used for the corner.

Output arguments

T
Matrix with numel(c) rows and numel(r) columns, where T(i,j) depends only on i-j.

Example

Symmetric and rectangular

toeplitz([1 2 3])
toeplitz([1 2 3], [1 5 6 7])
Output
ans = 3×3

     1     2     3
     2     1     2
     3     2     1
ans = 3×4

     1     5     6     7
     2     1     5     6
     3     2     1     5

See also

hankel vander conv2 circshift diag