www.pudn.com > GA_Toolbar.rar > CORANAEV.M, change:1997-04-07,size:554b


function [val] = coranaEval(sol) 
% function [val] = coranaEval(sol) 
% Determines the value of the Corana function at point sol. 
% This function is used in gademo2. 
% val - the value of the Corana function at point sol 
% sol - the location to evaluate the Corana function 
 
numv = size(sol,2); 
x=sol(1:numv); 
d0=[1 1000 10 100 1 10 100 1000 1 10]; 
d=d0(1:numv); 
c=0.15; 
s=.2*ones(1,numv); 
t=0.05*ones(1,numv); 
bk = s.*(round(x./s)); 
dev= (abs(bk-x)<t) & (bk~=0); 
z=c*((bk+sign(bk).*t).^2).*d; 
y=x.^2.*d; 
val = sum((dev.*z) + ((~dev).*y));