File: statgain.sci

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 (29 lines) | stat: -rw-r--r-- 654 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
function st=statgain(sl)

// Copyright INRIA
//-compat type(sl)<>15 retained for list/tlist compatibility
if type(sl)<>15&type(sl)<>16 then error(97,1),end
flag=sl(1);
select flag(1)
 case 'lss'
   dom=sl(7);
   [m,p]=size(sl(2));
   if dom=='c' then
     if rank(sl(2)) <> m then error('singular A matrix'),end
     st=sl(5)-sl(4)*inv(sl(2))*sl(3);
              else
     if rank(eye(m,m)-sl(2))<>m then error('singular eye-a matrix'),end
     st=sl(5)+sl(4)*inv(eye(m,m)-sl(2))*sl(3);
   end;
 case 'r' then
   dom=sl(4)
   if dom=='c' then
     st=freq(sl(2),sl(3),0)
              else
     st=freq(sl(2),sl(3),1)
   end;
 else  error(97,1)
end;