File: statgain.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 (29 lines) | stat: -rw-r--r-- 561 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
if 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('dt')
  if dom=='c' then
    st=freq(sl('num'),sl('den'),0)
  else
    st=freq(sl('num'),sl('den'),1)
  end;
else  
  error(97,1)
end