Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Group: Matrix Manipulation
Topic: General Commands
See also: matrix unit

Function: diag
Description: diag creates a diagonal matrix from a vector.

Usage: z = diag (x)
Input:
x p x 1 matrix
Output:
z p x p diagonal matrix

Example:

diag (1:4)
Result:

Contents of diag

[1,]        1        0        0        0 
[2,]        0        2        0        0 
[3,]        0        0        3        0 
[4,]        0        0        0        4 

Group: Matrix Manipulation
Topic: General Commands
See also: matrix unit

Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

(C) MD*TECH Method and Data Technologies, 28.6.1999