diff options
Diffstat (limited to 'modules/cacsd/macros/balreal.sci')
-rwxr-xr-x | modules/cacsd/macros/balreal.sci | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/modules/cacsd/macros/balreal.sci b/modules/cacsd/macros/balreal.sci new file mode 100755 index 000000000..974db5404 --- /dev/null +++ b/modules/cacsd/macros/balreal.sci @@ -0,0 +1,32 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) INRIA - +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + + +function [slb,u]=balreal(a) + + [lhs,rhs]=argn(0) + + if typeof(a)<>"state-space" 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 + 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 +endfunction |