The TOEPLITZ function generates a Toeplitz matrix from a vector, or a block Toeplitz matrix from a matrix. A block Toeplitz
               matrix has the property that all matrices on the diagonals are the same. The argument a is an  or
 or  matrix; the value returned is the
 matrix; the value returned is the  result.
 result. 
            
The TOEPLITZ function uses the first  submatrix,
 submatrix,  , of the argument matrix as the blocks of the main diagonal. The second
, of the argument matrix as the blocks of the main diagonal. The second  submatrix,
 submatrix,  , of the argument matrix forms one secondary diagonal, with the transpose
, of the argument matrix forms one secondary diagonal, with the transpose  forming the other. The remaining diagonals are formed accordingly. If the first
 forming the other. The remaining diagonals are formed accordingly. If the first  submatrix of the argument matrix is symmetric, the result is also symmetric. If
 submatrix of the argument matrix is symmetric, the result is also symmetric. If  is
 is  , the first p columns of the returned matrix,
, the first p columns of the returned matrix,  , are the same as
, are the same as  . If
. If  is
 is  , the first p rows of
, the first p rows of  are the same as
 are the same as  .
. 
            
The TOEPLITZ function is especially useful in time series applications, where the covariance matrix of a set of variables with its lagged set of variables is often assumed to be a block Toeplitz matrix.
If
![\[  \mb{A} = \left[ \mb{A}_1 | \mb{A}_2 | \mb{A}_3 |\cdots | \mb{A}_ n \right]  \]](images/imlug_langref1407.png)
 and if  is the matrix formed by the TOEPLITZ function, then
 is the matrix formed by the TOEPLITZ function, then 
            
![\[  \mb{R} = \left[ \begin{array}{ccccccccc} \mb{A}_1 &  | &  \mb{A}_2 &  | &  \mb{A}_3 &  | &  \cdots &  | &  \mb{A}_ n \\ \mb{A}_2^{\prime } &  | &  \mb{A}_1 &  | &  \mb{A}_2 &  | &  \cdots &  | &  \mb{A}_{n-1} \\ \mb{A}_3^{\prime } &  | &  \mb{A}_2^{\prime } &  | &  \mb{A}_1 &  | &  \cdots &  | &  \mb{A}_{n-2} \\ \vdots & & & & & & \\ \mb{A}_ n^{\prime } &  | &  \mb{A}_{n-1}^{\prime } &  | &  \mb{A}_{n-2}^{\prime } &  | &  \cdots &  | &  \mb{A}_1 \end{array} \right]  \]](images/imlug_langref1408.png)
If
![\[  \mb{A} = \left[ \begin{array}{c} \mb{A}_1 \\ \mb{A}_2 \\ \vdots \\ \mb{A}_ n \end{array} \right]  \]](images/imlug_langref1409.png)
 and if  is the matrix formed by the TOEPLITZ function, then
 is the matrix formed by the TOEPLITZ function, then 
            
![\[  \mb{R} = \left[ \begin{array}{ccccccccc} \mb{A}_1 &  | &  \mb{A}_2^{\prime } &  | &  \mb{A}_3^{\prime } &  | &  \cdots &  | &  \mb{A}_ n^{\prime } \\ \mb{A}_2 &  | &  \mb{A}_1 &  | &  \mb{A}_2^{\prime } &  | &  \cdots &  | &  \mb{A}_{n-1}^{\prime } \\ \vdots & & & & & & \\ \mb{A}_ n &  | &  \mb{A}_{n-1} &  | &  \mb{A}_{n-2} &  | &  \cdots &  | &  \mb{A}_1 \end{array} \right] ~   \]](images/imlug_langref1410.png)
Three examples follow:
r1 = toeplitz(1:5);
r2 = toeplitz({1 2 ,
               3 4 ,
               5 6 ,
               7 8});
r3 = toeplitz({1 2 3 4,
               5 6 7 8});
print r1, r2, r3;