home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 7.ddi / ROBUST.DI$ / HKL3.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  4.0 KB  |  103 lines

  1. %
  2. % 2-block H-inf problem
  3. %
  4.  
  5. % R. Y. Chiang & M. G. Safonov 8/85
  6. % Copyright (c) 1988 by the MathWorks, Inc.
  7. % All Rights Reserved.
  8. % ------------------------------------------------------------------
  9. disp('  ')
  10. disp('      << Working on Phase III: Interpolation problem >>')
  11. disp('  ')
  12. disp('   2-block H-inf problem (HKL3: T21 nonsquare, T12 square)')
  13. disp('  ')
  14. disp('            ..... Working ..... Please wait .....')
  15. if MReye == 2
  16.    flagtol = exist('tol');
  17.    if flagtol < 1
  18.       tol = input('Input error bound for model reduction: ');
  19.    end
  20.    no = tol;
  21. end
  22. seraug = [MRtype no];
  23. [ag1s,bg1s,cg1s,dg1s,ag1u,bg1u,cg1u,dg1u,mg1] = stabproj(ag1,bg1,cg1,dg1);
  24. [ag1m,bg1m,cg1m,dg1m,augm1,hsvgm] = schmr(...
  25. -ag1u,-bg1u,cg1u,dg1u,MRtype,no);
  26. [rrg1,rrg1] = size(ag1m);
  27. if rrg1 > twoN
  28.    disp('- - - - WARNING: THERE ARE STATES MORE THAN 2N ...')
  29.    disp('                 RESULTS MAY BE INCORRCT !!')
  30. end
  31. ag1m = -ag1m; bg1m = -bg1m;
  32. [am1,bm1,cm1,dm1] = sfr(ag1m,bg1m,cg1m,dg1m);
  33. [ahtl,bhtl,chtl,dhtl,hsvhtl] = sershbl(ahtt,bhtt,chtt,dhtt,...
  34.                     am1-bm1*inv(dm1)*cm1,-bm1*inv(dm1),...
  35.                     inv(dm1)*cm1,inv(dm1),seraug);
  36. [rrhtl,rrhtl] = size(ahtl);
  37. if rrhtl > twoN
  38.    disp('- - - - WARNING: THERE ARE STATES MORE THAN 2N ...')
  39.    disp('                 RESULTS MAY BE INCORRCT !!')
  40. end
  41. %
  42. %  IV). Zeroth order Hankel Approximation:
  43. %
  44. [a11h,B1h,C1h,d1h,a22h,B2h,C2h,d2h,msat] = stabproj(-ahtl',-chtl',bhtl',dhtl');
  45. [ay,by,cy,dy,ayu,byu,cyu,dyu,aughsv] = ohkapp(a11h,B1h,C1h,d1h,1,0);
  46. hsvmx = aughsv(1,1)
  47. if  aughsv(1,1) <= 1.0
  48.          [axt1,bxt1,cxt1,dxt1] = addss(ayu,byu,cyu,dyu,a22h,B2h,C2h,d2h);
  49.          [mahtl,nahtl] = size(ahtl);
  50.          if msat == mahtl
  51.             axt1 = ayu; bxt1 = byu; cxt1 = cyu; dxt1 = dyu+d2h;
  52.          end 
  53.          axtl = -axt1';
  54.          bxtl = -cxt1';
  55.          cxtl =  bxt1';
  56.          dxtl =  dxt1';
  57.          [aq,bq,cq,dq,hsvq] = sershbl(am1,bm1,cm1,dm1,...
  58.                                axtl,bxtl,-cxtl,-dxtl,seraug);
  59.          [raq,caq] = size(aq);
  60.          if raq > twoN
  61.             disp('- - - - WARNING: THERE ARE STATES MORE THAN 2N ...')
  62.             disp('                 RESULTS MAY BE INCORRCT !!')
  63.          end
  64.          [rdq,cdq] = size(dq);
  65.          [rC2,cC2] = size(C2);
  66.          [rf,cf]   = size(f);
  67.          [rh,ch]   = size(h);
  68.          bqq = -bq * inv(ml);
  69.          cqq = inv(mr) * cq;
  70.          dqq = -inv(mr) * dq * inv(ml);
  71.          dq22 = inv([eye(rdq) -D22;-dqq eye(rdq)]);
  72.          cq22 = [C2+D22*f zeros(rC2,caq);zeros(rdq,cC2) cqq];
  73.          bq2h = [h B2;bqq zeros(raq,rf)];
  74.          acp  = [at12 zeros(cf,caq);zeros(raq,cf) aq] + ...
  75.                  bq2h * dq22 * cq22;
  76.          bcp  = -bq2h*dq22 * [eye(rdq);zeros(rdq)];
  77.          ccp  = [f zeros(rf,caq)] + [zeros(rf,cdq) eye(rf)] *... 
  78.                  dq22 * cq22;
  79.          dcp  = -dqq * inv(eye(rdq)-D22*dqq);
  80.          acl  = [at12 bt12*dq*ct21-B2*f bt12*cq;...
  81.                  zeros(rat0,cat1) at21 zeros(rat0,caq);...
  82.                  zeros(raq,cat1) bq*ct21 aq];
  83.          bcl  = [bt12*dq*dt21+B1;bt21;bq*dt21];
  84.          ccl  = [ct12 dt12*dq*ct21-D12*f dt12*cq];
  85.          dcl  = dt11+dt12*dq*dt21;
  86.          disp('  ')
  87.          disp('  ')
  88.          disp(' ----------------------------------------------------------');
  89.          disp('   LINF computation is done .....');
  90.          disp('      state-space of the controller: (acp,bcp,ccp,dcp)');
  91.          disp('      state-space of the CLTF Ty1u1: (acl,bcl,ccl,dcl)');
  92.          disp('   Plots of S & (I-S) problem ---> run script file: pltopt');
  93.          disp(' ----------------------------------------------------------');
  94. else
  95.          disp('  ')
  96.          disp('  ')
  97.          disp(' ----------------------------------------------------------');
  98.          disp('    NO STABILIZING CONTROLLER MEETS THE SPEC. !!')
  99.          disp('    ADJUST "Gam" AND REDO PHASE I, II AND III.')
  100.          disp(' ----------------------------------------------------------');
  101. end
  102. %
  103. % ----- End of HKL3.M ---- RYC/MGS %