diag

Navigation:  Language Reference > Functions > Matrix >

diag

Previous pageReturn to chapter overviewNext page

Syntax

Y = diag(x);

Description

Fills the diagonal elements of the matrix Y with the elements of the columvector x.

Example

variables

 real x[3];

 real Y[3,3];

equations

 x = [1;2;3];

 Y = diag(x);

Limitations

Y must be a matrix of size [n,n]. x must be a column vector of size n.