home *** CD-ROM | disk | FTP | other *** search
- function [A,B,C,D] = feedbk(Z1,Z2,Z3,Z4,Z5,Z6,Z7,Z8,Z9)
- % [SS_] = FEEDBK(SS_1,TYPE,SS_2) or
- % [A,B,C,D] = FEEDBK(A1,B1,C1,D1,TYPE,A2,B2,C2,D2) produces a
- % state-space closed-loop transfer function for 5 common
- % types of negative feedback:
- %
- % TYPE= 1 ---- forward loop, I; feedback loop, (A1,B1,C1,D1).
- % TYPE= 2 ---- forward loop, (A1,B1,C1,D1); feedback loop, I.
- % TYPE= 3 ---- forward loop, (A1,B1,C1,D1); feedback loop, (A2,B2,C2,D2).
- % TYPE= 4 ---- state feedback: A2 <-- F.
- % TYPE= 5 ---- output injection: A2 <-- H.
- %
-
- % R. Y. Chiang & M. G. Safonov 6/87
- % Copyright (c) 1988 by the MathWorks, Inc.
- % All Rights Reserved.
- % ------------------------------------------------------------------------
- %
- nag1 = nargin;
-
- inargs = '(a1,b1,c1,d1,Type,a2,b2,c2,d2)';
- eval(mkargs(inargs,nargin,'ss'))
- nag1 = nargin; % NARGIN has been changed
-
- if nag1 == 6 & Type == 4
- % Case (a1,b1,c1,d1,Type,F)
- f = a2;
- end
- if nag1 == 6 & Type == 5
- % Case (a1,b1,c1,d1,Type,H)
- h = a2;
- end
-
- if Type== 1
- sz = size(d1)*[1;0];
- idiv = inv(eye(sz)+d1);
- A = a1-b1*idiv*c1;
- B = b1*idiv;
- C = -idiv*c1;
- D = idiv;
- end
- %
- if Type== 2
- sz = size(d1)*[1;0];
- idiv = inv(eye(sz)+d1);
- A = a1-b1*idiv*c1;
- B = b1*idiv;
- C = idiv*c1;
- D = idiv*d1;
- end
- %
- if Type== 3
- dji = d2*d1;
- dij = d1*d2;
- szj = size(dji)*[1;0];
- szi = size(dij)*[1;0];
- iii = inv(eye(szj)+dji);
- jjj = inv(eye(szi)+dij);
- A = [a1-b1*iii*d2*c1 -b1*iii*c2;b2*jjj*c1 a2-b2*jjj*d1*c2];
- B = [b1*iii;b2*jjj*d1];
- C = [jjj*c1 -jjj*d1*c2];
- D = jjj*d1;
- end
- %
- if Type== 4
- f = a2;
- A = a1-b1*f;
- B = b1;
- C = c1-d1*f;
- D = d1;
- end
- %
- if Type== 5
- h = a2;
- A = a1-h*c1;
- B = b1-h*d1;
- C = c1;
- D = d1;
- end
- %
- if xsflag
- A = mksys(A,B,C,D);
- end
- %
- % ------- End of FEEDBK.M -- % RYC/MGS %