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

  1. function [A,B,C,D] = feedbk(Z1,Z2,Z3,Z4,Z5,Z6,Z7,Z8,Z9)
  2. % [SS_] = FEEDBK(SS_1,TYPE,SS_2) or
  3. % [A,B,C,D] = FEEDBK(A1,B1,C1,D1,TYPE,A2,B2,C2,D2) produces a 
  4. %    state-space closed-loop transfer function for 5 common 
  5. %    types of negative feedback:
  6. %    
  7. % TYPE= 1 ---- forward loop, I; feedback loop, (A1,B1,C1,D1).
  8. % TYPE= 2 ---- forward loop, (A1,B1,C1,D1); feedback loop, I.
  9. % TYPE= 3 ---- forward loop, (A1,B1,C1,D1); feedback loop, (A2,B2,C2,D2).
  10. % TYPE= 4 ---- state feedback: A2 <-- F.
  11. % TYPE= 5 ---- output injection: A2 <-- H.
  12.  
  13. % R. Y. Chiang & M. G. Safonov 6/87
  14. % Copyright (c) 1988 by the MathWorks, Inc.
  15. % All Rights Reserved.
  16. % ------------------------------------------------------------------------
  17. %
  18. nag1 = nargin;
  19.  
  20. inargs = '(a1,b1,c1,d1,Type,a2,b2,c2,d2)';
  21. eval(mkargs(inargs,nargin,'ss'))
  22. nag1 = nargin; % NARGIN has been changed
  23.  
  24. if nag1 == 6 & Type == 4
  25.    % Case (a1,b1,c1,d1,Type,F)
  26.    f = a2;
  27. end
  28. if nag1 == 6 & Type == 5
  29.    % Case (a1,b1,c1,d1,Type,H)
  30.    h = a2;
  31. end
  32.  
  33. if Type== 1
  34.    sz = size(d1)*[1;0];
  35.    idiv = inv(eye(sz)+d1);
  36.    A = a1-b1*idiv*c1;
  37.    B = b1*idiv;
  38.    C = -idiv*c1;
  39.    D = idiv;
  40. end
  41. %
  42. if Type== 2
  43.    sz = size(d1)*[1;0];
  44.    idiv = inv(eye(sz)+d1);
  45.    A = a1-b1*idiv*c1;
  46.    B = b1*idiv;
  47.    C = idiv*c1;
  48.    D = idiv*d1;
  49. end
  50. %
  51. if Type== 3
  52.    dji = d2*d1;
  53.    dij = d1*d2;
  54.    szj = size(dji)*[1;0];
  55.    szi = size(dij)*[1;0];
  56.    iii = inv(eye(szj)+dji);
  57.    jjj = inv(eye(szi)+dij);
  58.    A = [a1-b1*iii*d2*c1 -b1*iii*c2;b2*jjj*c1 a2-b2*jjj*d1*c2];
  59.    B = [b1*iii;b2*jjj*d1];
  60.    C = [jjj*c1 -jjj*d1*c2];
  61.    D = jjj*d1;
  62. end
  63. %
  64. if Type== 4
  65.    f = a2;
  66.    A = a1-b1*f;
  67.    B = b1;
  68.    C = c1-d1*f;
  69.    D = d1;
  70. end
  71. %
  72. if Type== 5
  73.    h = a2;
  74.    A = a1-h*c1;
  75.    B = b1-h*d1;
  76.    C = c1;
  77.    D = d1;
  78. end
  79. %
  80. if xsflag 
  81.    A = mksys(A,B,C,D);
  82. end
  83. %
  84. % ------- End of FEEDBK.M -- % RYC/MGS %