functionf=lbw(x)
if(x(1)>30|x(1)<-30|x(2)>30|x(2)<-30|x(3)>30|x(3)<-30|x(4)>30|x(4)<-30|x(5)>30|x(5)<-30|x(6)>30|x(6)<-30|x(7)>30|x(7)<-30|x(8)>30|x(89)<-30|x(9)>30|x(9)<-30|x(10)>30|x(10)<-30)
f=300;
else
f=-2*pi*exp(-0.2*sqrt(1/10*((x(1)).^2+(x(2)).^2+(x(3)).^2+(x(4)).^2+(x(5)).^2+(x(6)).^2+(x(7)).^2+(x(8)).^2+(x(9)).^2+(x(10)).^2)))-exp(1/10*(cos(2*pi*x(1))+cos(2*pi*x(2))+cos(2*pi*x(3))+cos(2*pi*x(4))+cos(2*pi*x(5))+cos(2*pi*x(6))+cos(2*pi*x(7))+cos(2*pi*x(8))+cos(2*pi*x(9))+cos(2*pi*x(10))))+2*pi;
end
>>options=gaoptimset('Generations',800,'StallGenLimit',300,'PlotFcns',@gaplotbestf);
>>[x,f]=ga(@lbw,10,options)