File: balreal.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 (28 lines) | stat: -rw-r--r-- 711 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
function [slb,u]=balreal(a)
// Copyright INRIA
[lhs,rhs]=argn(0)
//-compat type(a)<>15 retained for list/tlist compatibility
if type(a)<>15&type(a)<>16 then error(91,1),end
ttp=a(1);
if ttp(1)<>'lss' then error(91,1),end
[a,b,c,d,x0,dom]=a(2:7);
if dom==[] then error(96,1),end
domain='c';
if dom<>'c' then domain='d',end
if lhs>2  then error('balreal: 1 or 2 output arguments: slb [,u]'),end
wc=lyap(a',-b*b',domain)
wo=lyap(a,-c'*c,domain)
r=chol(wo);x=r*wc*r';[u,s,v]=svd(x);s=diag(s);
ns=size(s,'*');
lli=sqrt(sqrt(s));ll=ones(ns,1)./lli
ri=inv(r)*v;r=v'*r;
a=r*a*ri;b=r*b;c=c*ri
a=diag(ll)*a*diag(lli)
b=diag(ll)*b
c=c*diag(lli)
slb=syslin(dom,a,b,c,d,diag(ll)*r*x0),
if lhs==2 then u=ri*diag(lli),end