% Constrained minimization with gradient expressions available


% If you have no constraints or only bound constraints,use 'LargeScale' = 'on'.
% If you have linear constraints, use 'LargeScale' = 'off'.

clc
clear all

options = optimset ('LargeScale', 'off', 'GradObj', 'on', 'GradConstr', 'on', 'TolCon', 1e-8, 'TolX', 1e-8);

Lb = [13; 0]; Ub = [100; 100];

% Set initial design
x0 = [20.1; 5.84];
% Invoke fmincon; four [ ] indicate no linear constraints in the problem

[x,FunVal, ExitFlag, Output] = fmincon('obj3',x0,[ ],[ ],[ ],[ ],Lb, Ub,'congrad3',options)