perf1.m

来自「王小平《遗传算法——理论、应用与软件实现》随书光盘」· M 代码 · 共 26 行

M
26
字号
function [out]=perf(in,x,y,h,id);
%
% Calculates the performance of a given
% set of parameters that have been decoded
% from the population members.
% Works for the whole population.
%
global stop;

[D L]=size(in);

for i = 1 : D
	if stop == 1
		break;
	end
	if id == 1
		set(h,'position',[410 25 180*(i/D) 20]);
	else
		set(h,'position',[410 65 180*(i/D) 20]);
	end
	c=in(i,:);
	yest=x*c';
	out(i,1)=sum((y-yest).^2);
end

⌨️ 快捷键说明

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