I am trying to find the global minimum of the Ackley function using a genetic algorithm 'ga'. My code works fine until i try to add lower and upper bounds then I get errors. Please help me add the bounds to my code.

`function y = myFitness(x)y = -20.*exp(-0.2.*sqrt(0.5.*(x(1).^2+ x(2).^2))) - exp(0.5.*(cos(2.*pi.*x(1)))+(cos(2.*pi.*x(2))))+exp(1)+20;endclcFitFcn = @myFitness;nvars = 2;lb = [-5 5];ub = [5 5];[x, fval] = ga(FitFcn, nvars)`

## Best Answer