summaryrefslogtreecommitdiff
path: root/modules/cacsd/macros/markp2ss.sci
diff options
context:
space:
mode:
Diffstat (limited to 'modules/cacsd/macros/markp2ss.sci')
-rwxr-xr-xmodules/cacsd/macros/markp2ss.sci35
1 files changed, 35 insertions, 0 deletions
diff --git a/modules/cacsd/macros/markp2ss.sci b/modules/cacsd/macros/markp2ss.sci
new file mode 100755
index 000000000..2082b3ec2
--- /dev/null
+++ b/modules/cacsd/macros/markp2ss.sci
@@ -0,0 +1,35 @@
+// 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 [Sl]=markp2ss(markpar,n,nout,nin)
+ // Given a set of n (matrix) Markov parameters stacked in the (row)-matrix
+ // markpar of size nout x (n*nin) markp2ss
+ // returns a state-space linear system Sl (syslin list) such that with:
+ // A=sl(2); B=sl(3); C=sl(4);
+ // C*B = markpar(1:nout,1:nin),
+ // C*A*B =marpar(1:nout,nin+1:2*nin),....
+ // See also: pol2des
+ //!
+
+ nmax=max(size(markpar));
+ H=[];H(n*nout,n*nin)=0;
+ p=markpar;
+ l1=1:nout;k1=1;
+ H(l1,:)=p;kset=(nmax-nin+1):nmax;zeroing=0*ones(nout,nin);
+ for k=2:n;
+ l1=l1+nout*ones(l1);
+ k1=k1+nin;
+ p=markpar(:,k1:nmax);p(nout,nmax)=0;
+ H(l1,:)=p;
+ end;
+ [u,s,v,deg]=svd(H);
+ obs=u(:,1:deg);con=s*v(1:deg,:)';
+ obstild=obs(nout+1:n*nout,:);obstild(n*nout,deg)=0;
+ Sl=syslin("c",obs'*obstild,con(1:deg,1:nin),obs(1:nout,:))
+endfunction