Code covered by the BSD License  

Highlights from
Continuous and discrete time optimal reduced order output feedback

Continuous and discrete time optimal reduced order output feedback

by

 

17 Jan 2011 (Updated )

Software associated with : International Journal of Control, 83, 12, 2546-2563, 2010

[a,b,nze]=kab2ab(kab,na,ma,nb,mb)
% KAB2AB: Function to reconstruct a,b from kron(a,b)
%         The result is unique up to a scaling factor
%         The first non-zero element of a is scaled to 1
%         
%         [a,b,nze]=kab2ab(kab,na,ma,nb,mb)
%
%         Input
%         kab   : kron(a,b)
%         na,ma : dimensions a
%         nb,mb : dimensions b
%
%         Output
%         a,b
%         nze   : non-zero element in kron(a,b) used for scaling
%
%         L.G. van Willigenburg, W.L. de Koning, 25-11-2008
%
function [a,b,nze]=kab2ab(kab,na,ma,nb,mb)

[nh,mh]=size(kab);
if nh~=na*nb; error('  Incompatible sizes a, kron(a,b)'); end;
if mh~=ma*mb; error('  Incompatible sizes b, kron(a,b)'); end;

if issparse(kab); kab=full(kab); end

% Find non-zero entry
nze=0; i1=0; i2=1;
while abs(nze)<=eps && i2<=mh;
  i1=i1+1; if i1>nh; i2=i2+1; i1=1; end  
  if i2<=mh; nze=kab(i1,i2); end
end

% Determine a,b
if i2>mh  % No zero entry: a=0, b=0
  b=zeros(nb,mb); a=zeros(na,ma);
else % Reconstruct a,b
  ir1=rem(i1-1,nb)+1; ir2=rem(i2-1,mb)+1;
  ib1=i1-ir1; ib2=i2-ir2; % indices first element of b
  b=kab(ib1+1:ib1+nb,ib2+1:ib2+mb);
  ia1=ir1:nb:nh; ia2=ir2:mb:mh; % indices elements of a
  a=kab(ia1,ia2)/nze;
end

Contact us