www.gusucode.com > 《MATLAB智能算法30个案例》分析源代码 > 《MATLAB智能算法30个案例》分析源代码/code/chapter2/案例3非线性/nonlinear.m

    function ret = nonlinear(chrom,sizepop)

for i=1:sizepop
    x=fmincon(inline('-20*exp(-0.2*sqrt((x(1)^2+x(2)^2)/2))-exp((cos(2*pi*x(1))+cos(2*pi*x(2)))/2)+20+2.71289'),chrom(i,:)',[],[],[],[],[-5 -5],[5 5]);
    ret(i,:)=x';
end