h2>Mixed constraints<a name="5"></a></h2><pre class="codeinput">xsol = fminsearchcon(rosen,[0 0],[2 -inf],[inf 3])
</pre><pre class="codeoutput">
xsol =

            2            3

</pre><h2>Fix a variable as constant, x(2) == 3<a name="6"></a></h2><pre class="codeinput">fminsearchcon(rosen,[3 3],[-inf 3],[inf,3])
</pre><pre class="codeoutput">
ans =

       1.7314            3

</pre><h2>Linear inequality, x(1) + x(2) &lt;= 1<a name="7"></a></h2><pre class="codeinput">fminsearchcon(rosen,[0 0],[],[],[1 1]