title: fminsearch multiple parameters matlab
body: <p>I'm trying to use fminsearch with multiple parameters but I can't seem to even get it working with two. I've also tried using optimization tool in matlab but then I get:</p>
  
  <pre><code>Optimization running.
  Error running optimization.
  Not enough input arguments. 
  </code></pre>
  
  <p>What i do:</p>
  
  <pre><code>fval = fminsearch(@g,[1 1])
  </code></pre>
  
  <p>The function g looks like this:</p>
  
  <pre><code>function r=g(x,y)
     r=x.^3+3*x*y.^2+12*x*y;
  end
  </code></pre>
  
  <p>but i get this:</p>
  
  <pre><code>Error using g (line 2)
  Not enough input arguments.
  
  Error in fminsearch (line 190)
  fv(:,1) = funfcn(x,varargin{:});
  </code></pre>