File: ss2des.sci

package info (click to toggle)
scilab 4.0-12
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 100,640 kB
  • ctags: 57,333
  • sloc: ansic: 377,889; fortran: 242,862; xml: 179,819; tcl: 42,062; sh: 10,593; ml: 9,441; makefile: 4,377; cpp: 1,354; java: 621; csh: 260; yacc: 247; perl: 130; lex: 126; asm: 72; lisp: 30
file content (26 lines) | stat: -rw-r--r-- 785 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
function S=ss2des(Sl,flag)
// Returns S=list('des',A,B,C,D,E) for Sl a state-space
// system with Ds polynomial.
// if flag=="withD" a maximal rank D matrix is returned in S
// otherwise D=0;
// Copyright INRIA
[LHS,RHS]=argn(0);
if RHS==1 then flag=[];end
if RHS==2&flag<>"withD" then warning("ss2des: unknown flag!");end
Ds=Sl(5);
if type(Ds)==1 then
  if norm(Ds,1)==0 then S=Sl;return;end
  if norm(Ds,1)<>0 then Sl(5)=Ds+poly(0,'s')*0*Ds;end
end
[A2,B2,C2,Ds]=Sl(2:5);
if flag=="withD" then D=coeff(Ds,0);Ds=Ds-D;end
[N,B1,C1]=pol2des(Ds);
[n1,n1]=size(N);
[n2,n2]=size(A2);
E=[N,0*ones(n1,n2);0*ones(n2,n1),eye(n2,n2)];
A=[eye(N),0*ones(n1,n2);0*ones(n2,n1),A2];
C=[C1,C2];
B=[B1;B2];
if flag<>"withD" then D=0*C*B;end
S=tlist(['des','A','B','C','D','E'],A,B,C,D,E);
endfunction