main.m698 chars18 lines
In this example, objectiveFunction is the function that you want to optimize, lb and ub are the lower and upper bounds for the parameters, options specifies additional options for the genetic algorithm, and ga is the function that runs the genetic algorithm to optimize the parameters. The optimal parameters are stored in x and the objective function value at the optimal parameters is stored in fval.
gistlibby LogSnag