Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function
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
andr
are provided,c(1)==r(1)
is required.The types of
c
andr
must be compatible w.r.t. the concatenation.- A
Matrix of the type of
c
andr
(with usual types priorities)A
is of size[size(c,"*"), size(c,"*")]
or[size(c,"*"), size(r,"*")]
.A
is sparse encoded as soon as eitherc
orr
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:
--> 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 >> |