Documentation Center

  • Trial Software
  • Product Updates

diag

Diagonalize vector of uncertain matrices and systems

Syntax

v = diag(x)

Description

If x is a vector of uncertain system models or matrices, diag(x) puts x on the main diagonal. If x is a matrix of uncertain system models or matrices, diag(x) is the main diagonal of x. diag(diag(x)) is a diagonal matrix of uncertain system models or matrices.

Examples

The statement produces a diagonal system mxg of size 4-by-4. Given multivariable system xx, a vector of the diagonal elements of xxg is found using diag.

x = rss(3,4,1); 
xg = frd(x,logspace(-2,2,80)); 
size(xg) 

FRD model with 4 output(s) and 1 input(s), at 80 frequency point(s). 

mxg = diag(xg); 
size(mxg) 
FRD model with 4 output(s) and 4 input(s), at 80 frequency point(s). 

xxg = [xg(1:2,1) xg(3:4,1)]; 
m = diag(xxg); 
size(m) 
FRD model with 2 output(s) and 1 input(s), at 80 frequency point(s). 

See Also

Was this topic helpful?