dae (version 3.2.25)

mat.banded: Form a banded matrix from a vector of values

Description

Takes the first value in x and places it down the diagonal of the matrix. Takes the second value in x and places it down the first subdiagonal, both below and above the diagonal of the matrix. The third value is placed in the second subdiagonal and so on, until the bands for which there are elements in x have been filled. All other elements in the matrix will be zero.

Usage

mat.banded(x, nrow, ncol)

Value

An \(nrow \times ncol\)

matrix.

Arguments

x

A numeric containing the values for each band from 1 to the length of x.

nrow

The number of rows in the banded matrix being formed.

ncol

The number of columns in the banded matrix being formed.

Author

Chris Brien

See Also

mat.cor, mat.corg, mat.ar1, mat.ar2, mat.ar3, mat.sar2, mat.exp, mat.gau, mat.ma1, mat.ma2, mat.arma mat.I, mat.J

Examples

Run this code
      m <- mat.banded(c(1,0.6,0.5), 5,5)
      m <- mat.banded(c(1,0.6,0.5), 3,4)
      m <- mat.banded(c(1,0.6,0.5), 4,3)

Run the code above in your browser using DataLab