) norm(x) - 1)

%% Minimize a linear objective, subject to a nonlinear constraints.
fun = @(x) x*[-2;1];
nonlcon = @(x) [norm(x) - 1;sin(sum(x))];
fminsearchcon(fun,[0 0],[],[],[],[],nonlcon)

%% Provide your own fminsearch options
opts = optimset('fminsearch');
opts.Display = 'iter';
opts.TolX = 1.e-12;
opts.MaxFunEvals = 100;

n = [10,5];
H = randn(n);
H=H'*H;
Quadraticfun = @(x) x*H*x';

% Global minimizer is at [0 0 0 0 0].
% Set all lower bound constraints, all of which will
% be active in this test.
L