Optimization Toolbox    

Nonlinear Inequality Constrained Example

If inequality constraints are added to Eq. 1-1, the resulting problem may be solved by the fmincon function. For example, find x that solves

    

(1-2)  

subject to the constraints

Since neither of the constraints is linear, you cannot pass the constraints to fmincon at the command line. Instead you can create a second M-file confun.m that returns the value at both constraints at the current x in a vector c. The constrained optimizer, fmincon, is then invoked. Because fmincon expects the constraints to be written in the form , you must rewrite your constraints in the form

    

(1-3)  

Step 1: Write an M-file confun.m for the constraints

Step 2: Invoke constrained optimization routine

After 38 function calls, the solution x produced with function value fval is

We can evaluate the constraints at the solution

Note that both constraint values are less than or equal to zero, that is, x satisfies .


 Unconstrained Example Constrained Example with Bounds