www.gusucode.com > globaloptim 案例源码程序 matlab代码 > globaloptim/ExaminetheSolutionProcessExample.m
%% Examine the Solution Process % Return the optional output arguments to examine the solution process in % more detail. %% % Define the problem. fun = @(x)x(1)*exp(-norm(x)^2); lb = [-10,-15]; ub = [15,20]; options = optimoptions('particleswarm','SwarmSize',50,'HybridFcn',@fmincon); %% % Call |particleswarm| with all outputs to minimize the function and get % information about the solution process. rng default % For reproducibility nvars = 2; [x,fval,exitflag,output] = particleswarm(fun,nvars,lb,ub,options)