function [x fval history] = myproblem(x0)
global history
  history = [];
  options = optimset('OutputFcn', @myoutput);
  [x fval] = fminsearch(@objfun, x0,options);
end

function z = objfun(x)
  z = exp(x(1))*(4*x(1)^2+2*x(2)^2+x(1)*x(2)+2*x(2));
end

function stop = myoutput(x, optimvalues, state);
global history
  stop = false;
  if isequal(state,'iter')
    history = [history; x];
  end
end
