File: diag.cat

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (46 lines) | stat: -rw-r--r-- 1,207 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

diag(1)                        Scilab Function                        diag(1)
NAME
  diag - diagonal including or extracting

CALLING SEQUENCE
  [y]=diag(vm, [k])

PARAMETERS

  vm        : vector or matrix

  k         : integer (default value 0)

  y         : vector or matrix

DESCRIPTION
  for vm a (row or column) n-vector diag(vm) returns a diagonal matrix with
  entries of vm along the main diagonal.

  diag(vm,k) is a  (n+abs(k))x(n+abs(k)) matrix with the entries of vm  along
  the kth diagonal.  k=0  is the main diagonal k>0 is for upper diagonals and
  k<0 for lower diagonals.

  For a matrix vm, diag(vm,k) is the column vector made of entries of the kth
  diagonal of vm.  diag(vm) is the main diagonal of vm.  diag(diag(x))  is a
  diagonal matrix.

  To construct a diagonal linear system, use sysdiag.

  Note that eye(A).*A returns a diagonal matrix made with the diagonal
  entries of A. This is valid for any matrix (constant, polynomial, rational,
  state-space linear system,...).

  For example
  diag(-m:m) +  diag(ones(2*m,1),1) +diag(ones(2*m,1),-1)
  gives a tri-diagonal matrix of order 2*m+1

EXAMPLE
  diag([1,2])
  A=[1,2;3,4];
  diag(A)
  diag(A,1)

SEE ALSO
  sysdiag