title: "Not enough input arguments." when using fsolve with nested functions
body: <p>I am trying to make my own function in matlab to solve for a system of two nonlinear equations, while using a nested function to share some some parameters, here is a sample code:</p>
  
  <pre><code>function y=solve(a,x0)
  a;
  y=fsolve(nle,x0);                       % this is line 3
  
      function f=nle(x)
          f(1)=x(1)-a*x(1)^2-x(1)*x(2);   % this is line 6
          f(2)=2*x(2)-x(2)+3*x(1)*x(2);
      end
  
  end
  </code></pre>
  
  <p>Here <code>a</code> is the parameter I want to pass from command line to the function, and <code>x0</code> is the start point for the <code>fsolve</code>.</p>
  
  <p>However, when I call the function in malab after specifying <code>a=4</code> and <code>x0=[1 1]'</code>, it gave me the following error:</p>
  
  <pre><code>Error using solve/nle (line 6)
  Not enough input arguments.
  
  Error in solve (line 3)
  y=fsolve(nle,x0);
  </code></pre>
  
  <p>I'm quite a newbie for matlab, can anybody tell me where I am doing wrong?</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>EDIT:</strong>
  I tried substituting the <code>nle</code> with a function handle <code>@nle</code>, but seems something else went wrong:</p>
  
  <pre><code>Undefined function 'fsolve' for input arguments of type 'function_handle'.
  
  Error in solve (line 3)
  y=fsolve(@nle,x0);
  </code></pre>
  
  <p>Doesn't seem to make sense since I checked the documentation for <code>fsolve</code>, and it says it should indeed use a function handle there...</p>