ffun.m

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

M
24
字号
function fout=ffun(w,f,fun)
%FFUN   Apply function to MVFR matrix.
%       FFUN(W,F,'fun') applies the function specified in the
%       string 'fun' to the MVFR matrix, F.
%       W is the associated frequency vector.
%       The results are returned as an MVFR matrix.
%       Any function that accepts a matrix and returns a single
%       result can be specified in the string 'fun'.

%       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);
funstr=['fout=[fout;',fun,'(fm)];'];
k=1:m;
fout=[];
for i=0:lw-1
  fm=f(k+m*i,:);  % break up f into matrices
  eval(funstr);   % evaluate function and append to fout
end

⌨️ 快捷键说明

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