File: sm2des.sci

package info (click to toggle)
scilab 2.6-4
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 54,632 kB
  • ctags: 40,267
  • sloc: ansic: 267,851; fortran: 166,549; sh: 10,005; makefile: 4,119; tcl: 1,070; cpp: 233; csh: 143; asm: 135; perl: 130; java: 39
file content (28 lines) | stat: -rw-r--r-- 655 bytes parent folder | download | duplicates (2)
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
function des=sm2des(sysmat,n)
// Generalized system-matrix to descriptor
// sysmat=[-s E + A , B; C , D]
// des=list('des',A,B,C,D,E)
// n=size(A) (assumed square) (optional parameter)
// Copyright INRIA
[LHS,RHS]=argn(0)
[nl,nc]=size(sysmat);
E=-coeff(sysmat,1);
if RHS==1 then
     k=nc;n=k;
     while E(:,k)==0*E(:,k)
     k=k-1;n=k;
     end
     l=nl;n1=l;
     while E(l,:)==0*E(l,:)
     l=l-1;n1=l;
     end
end
if n1<>n then warning('cannot find n!');end
E=E(1:n,1:n);
A=coeff(sysmat(1:n,1:n),0);
B=coeff(sysmat(1:n,n+1:nc),0);
C=coeff(sysmat(n+1:nl,1:n),0);
D=coeff(sysmat(n+1:nl,n+1:nc),0);
des=tlist(['des','A','B','C','D','E'],A,B,C,D,E);