title: How to apply additional constraints on fsolve?
body: <p>This is a very simplified form of my problem.  I have two unknowns: <em>x(1)</em> and <em>x(2)</em>, where (i) <em>x(1)</em> is an integer in <em>[1,5]</em>, and (ii) <em>x(2)</em> lies between 0 and 1. I wish to solve an equation given in the second set of codes below, such that it picks the highest possible <em>x(1)</em> that satisfies the equation and satisfies condition (ii).  This solution must be unique.</p>
  
  <p>I thought I should apply some additional constraints in the function.  So far, I have the following ``mother'' code:</p>
  
  <pre><code>v = 1;
  fun = @root;
  x0 = [1,5];
  options = optimset('MaxFunEvals',100000,'MaxIter', 10000 );
  x = fsolve(fun,x0, options)
  </code></pre>
  
  <p>The function that I am referring is the following:</p>
  
  <pre><code>function D = root(x)
   D(1) = x(1)./5 + x(2) - .8;
  end
  </code></pre>