title: Error using fzero
body: <p>I need to know the minimum of the curve <code>y= sin(r)+r.^2</code> using <code>fzero</code>.
  I created a function:</p>
  
  <pre><code>function w=myfun(r)
  w=diff(sin(r)+r.^2);
  end
  </code></pre>
  
  <p>Then at the command window:</p>
  
  <pre><code>r=[-pi:.01:pi];
  fzero( @myfun,0)
  </code></pre>
  
  <p>But there is always an error:</p>
  
  <blockquote>
    <p>Operands to the <code>||</code> and <code>&amp;&amp;</code> operators must be convertible to logical scalar values.</p>
    
    <p>Error in <code>fzero</code> (line 327)<br>
       <code>elseif ~isfinite(fx) || ~isreal(fx)</code></p>
    
    <p><code>fzero(@myfun,0)</code></p>
  </blockquote>
  
  <p>What should I do?</p>