Nonlinear constraints, specified as a function handle or function name. nonlcon is a function that accepts a vector or array x and returns two arrays, c(x) and ceq(x).
c(x) is the array of nonlinear inequality constraints at x. fmincon attempts to satisfy
c(x) <= 0 for all entries of c.
ceq(x) is the array of nonlinear equality constraints at x. fmincon attempts to satisfy
ceq(x) = 0 for all entries of ceq.
For example,
x = fmincon(@myfun,x0,A,b,Aeq,beq,lb,ub,@mycon)
where mycon is a MATLAB function such as
function [c,ceq] = mycon(x)
c = … % Compute nonlinear inequalities at x.
ceq = … % Compute nonlinear equalities at x.
If the gradients of the constraints can also be computed and the SpecifyConstraintGradient option is true, as set by
options = optimoptions(‘fmincon’,‘SpecifyConstraintGradient’,true)