File: balreal.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-- 640 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)

if 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