Navigation: Language Reference > Functions > Matrix >
Y = diag(x);
Fills the diagonal elements of the matrix Y with the elements of the columvector x.
variables
real x[3];
real Y[3,3];
equations
x = [1;2;3];
Y must be a matrix of size [n,n]. x must be a column vector of size n.