我也是一个新手```````还请教一下哪里有没有视屏教程啊````
有谁需要,可以向我索取,我还有数字水印的教程.
我的邮箱:wyy0313@163.com
数字水印论坛欢迎大家来学习交流! " target="_blank">http://wyy022.
你好,你能帮我解决这个问题吗?
function ObjVal = objfun1(Chrom,switch);
% Dimension of objective function
Dim = 20;
% Compute population parameters
[Nind,Nvar] = size(Chrom);
% Check size of Chrom and do the appropriate thing
% if Chrom is [], then define size of boundary-matrix and values
if Nind == 0
% return text of title for graphic output
if switch == 2
ObjVal = ['DE JONG function 1-' int2str(Dim)];
% return value of global minimum
elseif switch == 3
ObjVal = 0;
% define size of boundary-matrix and values
else
% lower and upper bound, identical for all n variables
ObjVal = 100*[-5.12; 5.12];
ObjVal = ObjVal(1:2,ones(Dim,1));
end
% if Dim variables, compute values of function
elseif Nvar == Dim
% function 1, sum of xi^2 for i = 1:Dim (Dim=30)
% n = Dim, -5.12 <= xi <= 5.12
% global minimum at (xi)=(0) ; fmin=0
ObjVal = sum((Chrom .* Chrom)')';
% ObjVal = diag(Chrom * Chrom'); % both lines produce the same
% otherwise error, wrong format of Chrom
else
error('size of matrix Chrom is not correct for function evaluation');
end
% End of function
总是出现错误提示:
??? Error: File: OBJFUN1.M Line: 33 Column: 33
Illegal use of reserved keyword "switch".