function [x,fval,exitflag,output] = aula2(x)

x0 = [2; 1];
A = [1 1;
    -1 -1];
b = [3; -1];

%options = optimset('GradObj','on','Hessian','on','Display','iter'); 
options = optimset('Display','iter'); 

[x,fval,exitflag,output] = ...
fmincon(@f_obj, x0, A, b, [], [], [0; 0], [], [], options);
%fmincon(@f_obj, x0, A, b, [], [], [0; 0], [], [], options);

   function [f] = f_obj(x)
      f = ( x(1)+1 )^2 + ( x(2) - 1)^2; 
%
      % Evaluate the gradient.
      if nargout > 1
        g = 2*(x + [1; -1]);
      end
%
      % Evaluate the symmetric Hessian matrix
      if nargout > 2
        H = 2*eye(2);  
     end
