title: MATLAB: fzero with a matrix as input to function?
body: <p>I am trying to find the value x for a function f(x,y) that produces the function value 0 for a given y. In Matlab I write a small function handle, e.g.</p>
  
  <pre><code>minme = @(y,x) y-x.^2;
  </code></pre>
  
  <p>and use the fzero function to find that value of x, call it x*.</p>
  
  <p>So e.g.</p>
  
  <pre><code>fzero(@(x) minme(5,x),1)
  </code></pre>
  
  <p>works great. However, now I want to find x* for a large vector of values of y, called Y. Putting</p>
  
  <pre><code>minme(Y,x)
  </code></pre>
  
  <p>for some value of x works. </p>
  
  <p>Now I was trying something like</p>
  
  <pre><code>fzero(@(x) minme((3:1:5),x),1)
  </code></pre>
  
  <p>and
   fzero(@(x) minme(Y,x),1)</p>
  
  <p>but that produces an error: 
  <em>??? Operands to the || and &amp;&amp; operators must be convertible to logical scalar values.
  Error in ==> fzero at 333
      elseif ~isfinite(fx) || ~isreal(fx)</em></p>
  
  <p>Does anybody know whether there is a way to do this?</p>
  
  <p>Thanks,
  Immo</p>