mvfb.m

来自「包含大量遗传算法程序」· M 代码 · 共 47 行

M
47
字号
function [a,b,c,d]=mvfb(a1,b1,c1,d1,a2,b2,c2,d2)
%MVFB   Feedback connection of two state space systems.
%       [A,B,C,D]=MVFB(A1,B1,C1,D1,A2,B2,C2,D2)
%       returns the A,B,C,D of the two systems combined
%       in a negative feedback loop
%       A1,B1,C1,D1 is in the forward path
%       and A2,B2,C2,D2 is in the feedback path.

%       Dr M.P. Ford 4th August 1987
% Copyright (c) 1987 by GEC Engineering Research Centre & Cambridge Control Ltd
%       MRN0014
%       MRN0019

error(abcdchk(a1,b1,c1,d1));
error(abcdchk(a2,b2,c2,d2));
[ma1,na1]=size(a1);
[ma2,na2]=size(a2);
[md1,nd1]=size(d1);
[md2,nd2]=size(d2);
if md1~=nd2,
  error('Number of system 1 outputs must equal number of system 2 inputs')
end
if md2~=nd1,
  error('Number of system 1 inputs must equal number of system 2 outputs')
end

Idd = eye(md2) + d2*d1;
Iddd2 = Idd\d2;  Iddc2 = Idd\c2;
d = d1/Idd;

if abcpgchk(a1,b1,c1)  % Forward path system is pure gain
   a=a2 - b2*d1*Iddc2;
   b=b2*d;
   c=-d1*Iddc2;
else
   a=a1-b1*Iddd2*c1;
   b=b1/Idd;
   c=(eye(md1)-d1*Iddd2)*c1;
   if ~abcpgchk(a2,b2,c2)   % Feedback path system is NOT pure gain
      a=[a ,    -b1*Iddc2
	 b2*c ,  a2-b2*d1*Iddc2];
      b = [b ; b2*d];
      c = [c , -d1*Iddc2];
   end
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?