function varargout = ex2(x) % % % % [F] = ex2(x) returns the function value in F % [F,Jac] = ex2(x) returns the function value in F and % the Jacobian in Jac % % Matthias Heinkenschloss % Department of Computational and Applied Mathematics % Rice University % March 9, 2004 % % return the function value varargout{1} = [ 3*x(1)-cos(x(2)*x(3))-0.5; x(1)^2-81*(x(2)+0.1)^2+sin(x(3))+1.06; exp(-x(1)*x(2))+20*x(3)+(10*pi-3)/3]; if( nargout > 1 ) % return the Jacobian as the second argument varargout{2} = [3 x(3)*sin(x(2)*x(3)) x(2)*sin(x(2)*x(3)); 2*x(1) -162*(x(2)+0.1) cos(x(3)); -x(2)*exp(-x(1)*x(2)) -x(1)*exp(-x(1)*x(2)) 20 ]; end