title: Matlab: nest fzero in fminsearch
body: <p>I am trying to minimize with respect to a variable "y" a function that contains a parameter which must be calculated as a solution of an equality that contains "y" as well (say, y=-3; in my complete problem it is an equation with no analytic closed form solution, so I really need fzero).
  Because of this, I include the fzero function in the argument of fminsearch:</p>
  
  <pre><code> fminsearch( @(y) 10*fzero(@(y) y+3, 0)) ;
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code>Error using fminsearch (line 85)
  The input to FMINSEARCH should be either a structure with 
  valid fields or consist of at least two arguments.
  </code></pre>
  
  <p>I obviously get the same error with: 
      f = fzero(@(y) y+3, 0);
      fminsearch(@(y) 10*f);</p>
  
  <p>Apparently the problem is that I cannot "nest" a fzero inside fminsearch.
  Any idea about how to turn around this problem?</p>