I've just run the code in the doc page you mention (I post the code at the end of the message), and it runs with no errors, returning the answer provided in the doc.
Please compare your code with the code below and see if there's something missing.
%%%%%%%%%%%%%%%%%%% begin mydriver.m % mydriver is defined as a function so as to be able % to use subfunctions, and thus have everything % (objective, constraints, call to fmincon) in one file. function mydriver
x0 = [-1,1]; % Make a starting guess at the solution options = optimset('LargeScale','off'); [x, fval] = ... fmincon(@objfun,x0,,,,,,,@confun,options)
%-------------- subfunctions function f = objfun(x) f = exp(x(1))*(4*x(1)^2 + 2*x(2)^2 + 4*x(1)*x(2) + 2*x(2) + 1);
Ingrid Måge wrote: > Hi, > > I have a problem using fmincon. I get the following error message: > > ??? Error using ==> optimfcnchk > Too many input arguments. > > Error in ==> fmincon at 260 > [confcn, msg] = > optimfcnchk(NONLCON,'fmincon',length(varargin),funValCheck,gradconstfl > ag,false,1); > > I even get the error when I'm using the example from the optimisation > tutorial, so there shouldn't be anything wrong with my functions or > input. (http://www.mathworks.com/access/helpdesk/help/toolbox/optim/ug/f10912.html) > > I'm using version 7.1 (R14). > > I'll be very grateful if anyone can help me!