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

Get Process Control: Modeling, Design, and Simulation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.