Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.1 - English

Change language to:
Français - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2024.1.0. This page might be outdated.
See the recommended documentation of this function

Scilab Help >> Elementary Functions > Matrix generation > toeplitz

toeplitz

Toeplitz matrix (chosen constant diagonal bands)

Syntax

A = toeplitz(c)
A = toeplitz(c, r)

Arguments

c, r

vectors or matrices of booleans, numbers, polynomials, rationals, or texts, dense or sparse encoded (booleans or numbers).

c are values expected on the first column and subsequent lower diagonals. r are values expected on the first row and subsequent upper diagonals.

If both c and r are provided, c(1)==r(1) is required.

The types of c and r must be compatible w.r.t. the concatenation.

A

Matrix of the type of c and r (with usual types priorities)

A is of size [size(c,"*"), size(c,"*")] or [size(c,"*"), size(r,"*")].

A is sparse encoded as soon as either c or r or both are sparse encoded.

Description

A=toeplitz(c, r) returns the Toeplitz matrix whose first row is r and first column is c. toeplitz(c) returns the symmetric Toeplitz matrix.

Examples

toeplitz(0:3)
--> toeplitz(0:3)
 ans  =
   0.   1.   2.   3.
   1.   0.   1.   2.
   2.   1.   0.   1.
   3.   2.   1.   0.

toeplitz([0 1 0 0 ], [0 -1 -2 0 0 0])
--> toeplitz([0 1 0 0 ], [0 -1 -2 0 0 0])
 ans  =
   0.  -1.  -2.   0.   0.   0.
   1.   0.  -1.  -2.   0.   0.
   0.   1.   0.  -1.  -2.   0.
   0.   0.   1.   0.  -1.  -2.

With sparse encoded arrays:

v = [0 1:2 0 0];
S = toeplitz(v, sparse(-v));
typeof(S)
full(S)
--> typeof(S)
 ans  =
 sparse

--> full(S)
 ans  =
   0.  -1.  -2.   0.   0.
   1.   0.  -1.  -2.   0.
   2.   1.   0.  -1.  -2.
   0.   2.   1.   0.  -1.
   0.   0.   2.   1.   0.

With texts:

toeplitz(["-" "A" "B" "C"],["-" "a" "b" "c" "d" "e"])
--> toeplitz(["-" "A" "B" "C"],["-" "a" "b" "c" "d" "e"])
 ans  =
!-  a  b  c  d  e  !
!A  -  a  b  c  d  !
!B  A  -  a  b  c  !
!C  B  A  -  a  b  !

With polynomials:

toeplitz([%s %s^2 %s^3], [%s 1:4])
--> toeplitz([%s %s^2 %s^3], [%s 1:4])
 ans  =
   s    1    2   3   4

    2
   s    s    1   2   3

    3    2
   s    s    s   1   2

See also

  • diag — diagonal including or extracting
  • eye — identity matrix
  • testmatrix — generate special matrices, such as Hilbert, Franck
Report an issue
<< testmatrix Matrix generation zeros >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Feb 12 19:26:47 CET 2018