[ Team LiB ] Previous Section Next Section

Appendix 13.2: m-File to Calculate the RGA


  function lambda = rga(g)
%
% calculate the relative gain array for a
% square gain matrix of any size
%
% first, check the dimensions to see if the
% process gain matrix is square
%
  [mrow ncol]=size(g);
%
% if the gain matrix is not square, let the
% user know
%
  if mrow ~= ncol;
    disp('needs to be square, buddy')
    end;
  else
%
% the matrix ghat is simply the inverse of the
% gain matrix.  ghatt is the transpose of ghat
%
    ghat = inv(g);
    ghatt=ghat';
%
%  perform an element by element multiplication
%  of g and ghatt to find the relative gain array
%
    lambda = g.*ghatt;
  end
    [ Team LiB ] Previous Section Next Section