home *** CD-ROM | disk | FTP | other *** search
- % [xinf,f,fail,hamx,hxmin] = hinffi_g(p,ncon,epp,gam,imethd);
- %
- % solve the hamiltonian for xinf for the FULL
- % INFORMATION feedback case.
-
- function [xinf,f,fail,hamx,hxmin] = hinffi_g(p,ncon,epp,gam,imethd);
-
- [a,bp,cp,dp,b1,b2,c1,d11,d12,ndata] = hinffi_p(p,ncon);
- fail = 0;
- np = max(size(a));
- np1 = ndata(1);
- np2 = ndata(2);
- nm1 = ndata(3);
- nm2 = ndata(4);
- %
- % form r and rbar
- %
- d1dot = [d11,d12];
- r = zeros(nm1+nm2,nm1+nm2);
- r(1:nm1,1:nm1) = -gam*gam*eye(nm1);
- r = r+d1dot'*d1dot;
- %
- % form hamiltonian hamx for xinf
- %
- dum = ([bp;-c1'*d1dot]/r)*[d1dot'*c1,bp'];
- hamx = [a,0*a;-c1'*c1,-a']-dum;
- if imethd == 1
- %
- % solve the Riccati equation using eigenvalue decomposition
- %
- [x1,x2,fail,hxmin] = ric_eig(hamx,epp);
- if fail == 1,
- % fprintf(' ric(x) has jw axis eigs \n');
- xinf = [];
- else
- % really should check the condition number of x1 before doing this
- % but the MATLAB 'cond' command has problems
- xinf = real(x2/x1);
- % if max(eig(xinf)) == Inf | min(eig(xinf)) == -Inf
- if any(any(~finite(xinf)))
- fail = 1;
- xinf = [];
- end
- end
- elseif imethd == 2
- %
- % solve the Riccati equation using real schur decomposition
- %
- [x1,x2,fail,hxmin] = ric_schr(hamx,epp);
- if fail == 1 | fail == 3
- % fprintf(' ric(x) has jw axis eigs \n ');
- fail = 1;
- elseif fail == 2
- % fprintf(' ric(x) unequal number of pos and neg eigenvalues')
- fail = 1;
- else
- xinf = real(x2/x1);
- % if max(eig(xinf)) == Inf | min(eig(xinf)) == -Inf
- if any(any(~finite(xinf)))
- fail = 1;
- xinf = [];
- end
- end
- else
- error('type of solution method is invalid')
- return
- end
- %
- % form f submatrices
- %
- if fail == 1
- f = [];
- else
- f = -r\(d1dot'*c1+bp'*xinf);
- end
-
- %
- % Copyright MUSYN INC 1991, All Rights Reserved
-