 echo on
%
%	HIMAT_X4
%
%   It is assumed that you have just run 'himat_x3' 
%
%  This MATLAB script file is the fourth iteration of mu-synthesis 
%   control design for the HIMAT pitch axis control problem.
%
%  Fourth and final iteration of the mu-synthesis procedure. 
%   Design a H-infinity control law for the new interconnection 
%   structure which includes the frequency varying d-scales. 
%   HIMAT_IC4  has 20 states, 6 outputs and 6 inputs.
 
 [k4,g4,gf4]=hinfsyn(himat_ic4,2,2,0.9,1.2,.04,2);
 pack;
 
% Now a H-infinity control law has been designed which achieves an
%  infinity norm of 0.975 for the new interconnection structure.
%  The new system includes the frequency varying d-scales fit in
%  the second iteration. To verify the gamma value, a frequency
%  response of the closed loop is done and the maximum 
%  singular value of the closed-loop response across frequency
%  is plotted. We will also 
%  check that the closed-loop poles are stable.
 
 pause    % strike any key to continue
 format short e
 rifd(spoles(g4))
 pause    % strike any key to continue
 g4g=frsp(g4,om2);
 g4pk=pkvnorm(g4g);
 echo off
 fprintf( '\n final gamma %g, \n max singular value %g \n \n',gf4,g4pk)
 echo on
 g4gs=vsvd(g4g);
 vplot('liv,d',g4gs)
 echo off
 title('Singular value plot of Fourth Iteration in mu-synthesis');
 xlabel('Frequency (rad/s)');
 ylabel('Magnitude');
 grid;
 echo on
 pause    % strike any key to continue
 
%  The H-infinity control law can be analyzed using mu-analysis. The 
%  closed-loop system, g4, has 4 inputs and 4 outputs.  The block
%  structure again is a 2x2 full uncertainty block corresponding to
%  actuator multiplicative uncertainty and a 2x2 full performance 
%  block weighting the output sensitivity.
 
pause    % strike any key to continue
 [bnds4,dv4,sens4,rp4]=mu(g4g,blk);
 
% plot the maximum singular value and mu on the same plot
%   solid - maximum singular value
%   dashed - mu
 
 both=sbs(sel(g4gs,1,1),bnds4);
 vplot('liv,d',both)
 echo off
 title('Max. singular value and mu for the closed-loop system, g4');
 xlabel('Frequency (rad/s)');
 ylabel('Magnitude');
 grid;
 pause    % strike any key to continue
 echo on
 
% clear variables not used and pack the memory space due 
%  to the limitations on the Mac and PC's.
 
 clear rp4 g4g g4gs both 
 pack;
 
%  mu is below 1 !!  your control design has satisfied your 
%  stability requirements and performance requirements at the
%  same time. Therefore, the control law is said to exhibit
%  robust performance.
 
%  type in 'himat_x5' to see an analysis of the mu-control law
%  and loop shaping control law.
%
% Copyright MUSYN INC 1991,  All Rights Reserved
