1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 2// Copyright (C) INRIA - Serge Steer 3// 4// Copyright (C) 2012 - 2016 - Scilab Enterprises 5// 6// This file is hereby licensed under the terms of the GNU GPL v2.0, 7// pursuant to article 5.3.4 of the CeCILL v.2.1. 8// This file was originally licensed under the terms of the CeCILL v2.1, 9// and continues to be available under such terms. 10// For more information, see the COPYING file which you should have received 11// along with this program. 12 13function [sl]=imrep2ss(v,deg) 14 15 [lhs,rhs]=argn(0) 16 // hankel 17 [no,nv]=size(v); 18 n=nv/2; 19 ns1=no-1;n2=n-1; 20 l=1; 21 h= zeros(n,n); 22 for k=1:n,h(l:l+ns1,:)=v(:,k:k+n2),l=l+no,end; 23 //factorization 24 if rhs==1 then [u,h1,v1,deg]=svd(h);else [u,h1,v1]=svd(h);end 25 //extraction 26 obs=u(:,1:deg);con=h1*v1';con=con(1:deg,:); 27 //shift 28 obstild=obs(no+1:n*no,:);obstild(n*no,deg)=0; 29 sl=syslin("d",obs'*obstild,con(:,1),obs(1:no,:)) 30endfunction 31