title: Why does fsolve seem not iterate towards the solution?
body: <p>I am trying to sovle a two non-linear equation system using fsolve and dogleg method. My objective function along with its jacobian is like this</p>
  
  <pre><code>function [F jacF]= objective(x)
  
      F(:,1) = ((((x(:,2)./10).*k).*(x(:,1)./100)).^2).*(rZ - Rs) +(( Cmax .* ( x(:,1)./100 ) ).^2).*( w.^2.*(rZ - Rs) ) - (((x(:,2)./10).*k).*(x(:,1)./100)); 
  
      F(:,2) = (x(:,2).*k).^2.*(iZ - w.*Ls) + (x(:,2).*k).^2.*x(:,1).*((w.*Ls)./200) + x(:,1).*((w.*Ls)/200).*(w.*Cmax).^2 + (w.*Cmax).^2 .*(iZ -(w.*Ls));
  
      if nargout &gt; 1 % need Jacobian
          jacF = [- k - (k.^2.*x(:,2).*x(:,1).*(Rs - rZ))./50,                         - (k.^2.*x(:,2).^2.*(Rs - rZ))./100 - (Cmax.^2.*w.^2.*(Rs - rZ))./100;
                  2.*k.^2.*x(:,2).*(iZ - Ls.*w) + (k.^2.*Ls.*x(:,2).*w.*x(:,1))./100,(Ls.*Cmax.^2.*w.^3)./200 + (Ls.*k.^2.*x(:,2).^2.*w)./200];
      end
  end
  </code></pre>
  
  <p>Then my configuration for fsolve looks like this</p>
  
  <pre><code>    options = optimoptions('fsolve','Display','iter-detailed','PlotFcn',@optimplotfirstorderopt);
  %     options.StepTolerance = 1e-13;
      options.OptimalityTolerance = 1e-12;
      options.FunctionTolerance = 6e-11;
      options.MaxIterations = 100000;
      options.MaxFunctionEvaluations = 400;%*400;
      options.Algorithm = 'trust-region-dogleg';%'trust-region'%'levenberg-marquardt';%
  %     options.FiniteDifferenceType= 'central';
      options.SpecifyObjectiveGradient = true;
      fun= @objective;
  
      x0 = [x1',x2'];
  
      % Solve the function fun
      [gwc,fval,exitflag,output,jacobianEval] =fsolve(fun,x0,options);
  </code></pre>
  
  <p>Being the values of the equations </p>
  
  <pre><code>Rs =
      0.1640
  Ls =
     1.1000e-07
  Cmax =
     7.0000e-11
  w =
     1.7040e+08
  rZ =
     12.6518
  iZ = 
     14.5273
  K =
      0.1007
  x0 = 
      70.56 0.0759
  </code></pre>
  
  <p>My problem comes because I don't understand why fsolve seems not to iteratate over <code>x(:,1)</code> as i was expecting. I do know that the solution for the above system and parameters should be <code>x1=58.8</code> and <code>x2=0.0775</code>. 
  In order to test the convergence of the method I am setting as initial guess <code>x0 = [x1*(1+20/100) 0.0759] = [70.56 0.0759]</code> ( 20 percent error in x1 and a higer value  on x2), but the solution given by fsolve is the initial point, why is this? Am I doing something incorrect in my settings?</p>
  
  <p>Thanks in advance</p>
  
  <p>EDIT: added the equations, with generic coefficients
  <a href="https://i.stack.imgur.com/0vL0p.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0vL0p.png" alt="enter image description here"></a></p>