frsod.m

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

M
24
字号
function s=frsod(w,f)
%FRSOD  Row sum of abs(off-diagonals) of MVFR matrix
%       FRSOD(W,F) returns the row sum of the absolute
%       values of off diagonals of the component matrices of
%       the MVFR matrix, F, with one row per component matrix.
%       W is the associated frequency vector.
%       See also FCSOD,FRDOM,FCDOM

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

[m,n]=fsize(w,f);
lw=length(w);
if m~=n
  error('Not a square system');
end
s=ones(lw,m)*inf;   % Set up output matrix
k=1:m;             % vector of rows of each matrix in F
for i=1:lw          % for each frequency
  fm=abs(f(k+(i-1)*m,:))';  % column sum of the transpose
  s(i,:)=sum(fm)-diag(fm)';
end % for i=1:lw

⌨️ 快捷键说明

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