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
30
31
32
33
34
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
|