frd.m

来自「MFD-多变量系统频域设计工具」· M 代码 · 共 54 行

M
54
字号
function f = frd(w,g,h,k);
%FRD Return difference frequency response (MIMO).
%
% F = FRD(w,G,H,K) calculates the return difference matrix of a
% closed loop system.
%
%          F = I + GKH.
%                                                   
% The calculations are performed for the system: ------- K --- G --->---
% (see the Reference Manual entry for FRD)          -|             | 
%                                                     ----- H --<-- 
% The input arguments are, G the plant
% H a non-unity feedback matrix and
% K a pre-compensator. G, H and K are MVFR matrices.
% w is the associated frequency vector.

%     J-M. Boyle 8th September 1987
% Copyright (c) 1987 by GEC Engineering Research Centre & Cambridge Control Ltd.

nargs = nargin;
error(nargchk(4,4,nargs));       % Check the number of input arguments

[mg,ng] = fsize(w,g);
lw = length(w);
[mh,nh]=fsize(w,h);
[mk,nk]=fsize(w,k);
if nk~=mh
   error('Rows of H not equal to columns of K.')
end
if mk~=ng
   error('Rows of K not equal to columns of G.')
end
if nh~=mg
   error('Rows of G not equal to columns of H.')
end

id = eye(mg);
f =  zeros(mg*lw,nk);
indg = 1:mg;
indk = 1:mk;
indh = 1:mh;

for i=1:lw;
  gm = g(indg+mg*(i-1),:);
  km = k(indk+mk*(i-1),:);
  hm = h(indh+mh*(i-1),:);
  f(indg+mg*(i-1),:) = id + gm*km*hm;
                %F = I + GKH
end




⌨️ 快捷键说明

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