www.gusucode.com > globaloptim 案例源码程序 matlab代码 > globaloptim/PatternSearchwithBoundsExample.m
%% Pattern Search with Bounds % Find the minimum of a function that has only bound constraints. %% % Create the following two-variable objective function. On your MATLAB(R) % path, save the following code to a file named |psobj.m|. % % <include>psobj.m</include> % %% % Set the objective function to |@psobj|. fun = @psobj; %% % Find the minimum when $0 \le x(1) \le\infty$ % and $-\infty \le x(2) \le -3$. lb = [0,-Inf]; ub = [Inf,-3]; A = []; b = []; Aeq = []; beq = []; %% % Find the minimum, starting at the point |[1,-5]|. x0 = [1,-5]; x = patternsearch(fun,x0,A,b,Aeq,beq,lb,ub)