www.gusucode.com > globaloptim 案例源码程序 matlab代码 > globaloptim/PatternSearchwithaLinearInequalityConstraintExample.m
%% Pattern Search with a Linear Inequality Constraint % Minimize a function subject to some linear inequality 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; %% % Set the two linear inequality constraints. A = [-3,-2; -4,-7]; b = [-1;-8]; %% % Find the minimum, starting at the point |[0.5,-0.5]|. x0 = [0.5,-0.5]; x = patternsearch(fun,x0,A,b)