PROBLEM 3 function F = Dfun(x) F=[ x(1)^2+x(2)^2+x(3)^2+x(4)^2-2 x(1)+x(3)-x(2)-x(4) x(1)*x(3)+x(2)*x(4) x(2)+2*x(3)-3*x(4)]; >> x=fsolve(@Dfun,[1 1 1 1], optimset('Display','iter')) Norm of First-order Trust-region Iteration Func-count f(x) step optimality radius 1 5 8 6 1 2 10 0.962 0.6 0.63 1 3 11 0.962 1.5 0.63 1.5 4 16 0.624117 0.375 0.426 0.375 5 21 0.549772 0.9375 1.92 0.938 6 26 0.00407976 0.240966 0.138 0.938 7 31 6.73783e-007 0.0271066 0.00171 0.938 8 36 2.25591e-014 0.00036652 3.13e-007 0.938 Optimization terminated successfully: First-order optimality is less than options.TolFun. x = 1.1325 0.8162 -0.1325 0.1838 EXTRA CREDIT function F = myfun2(x) F=[ x(1)^2+x(2)^2+x(3)^2+x(4)^2-5 x(1)+x(3)-x(2)-x(4)+1 x(1)*x(3)+x(2)*x(4) x(2)+2*x(3)-3*x(4)]; >> x=fsolve(@myfun2,[1 1 1 1], optimset('Display','iter')) Norm of First-order Trust-region Iteration Func-count f(x) step optimality radius 1 5 6 1 1 2 10 5.50488 0.25 1.18 1 3 15 5.17324 0.15069 1.03 1 4 20 2.78724 1 3.23 1 5 25 0.668495 0.891381 2.77 2.5 6 30 0.00126802 0.182677 0.109 2.5 7 35 9.77783e-009 0.00944636 0.000288 2.5 8 40 7.85913e-019 2.81582e-005 2.56e-009 2.5 Optimization terminated successfully: First-order optimality is less than options.TolFun. x = 1.3798 1.6899 -0.3798 0.3101