Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
System of nonlinear equations: no convergence to a root using fsolve

Subject: System of nonlinear equations: no convergence to a root using fsolve

From: Romain

Date: 8 Jul, 2011 16:56:09

Message: 1 of 3

Hello everybody,

I have a problem using the fsolve function. The aim of the procedure I implement is to identify a matrix subject to certain restrictions. To do so, I can decompose my matrix into a nonlinear system of equations. It is a rather small system (8 equations, 8 unknown), however, when I use the fsolve function, I always obtain the error message:'Optimizer appears to be converging to a minimum that is not a root:Sum of squares of the function values exceeds the square root of options.Tolfun.Try again with a new starting point'. I tried with many different initial values, but that was no improvement. Precisely, here is my system:

F(1)=x(1)^2+x(2)^2+x(3)^2-EXO_SIGMA1SQ;
F(2)=x(4)^2+x(5)^2+x(6)^2-EXO_SIGMA2SQ;
F(3)=x(7)^2+x(8)^2-EXO_SIGMA3SQ;
F(4)=x(1)*x(4)+x(2)*x(5)+x(3)*x(6)-EXO_SIGMA12;
F(5)=x(2)*x(7)+x(3)*x(8)-EXO_SIGMA13;
F(6)=x(5)*x(7)+x(6)*x(8)-EXO_SIGMA23;
F(7)=x(2)*EXO_K1+x(5)*EXO_K2+x(7);
F(8)=x(3)*EXO_K1+x(6)*EXO_K2+x(8);
The EXO variables are constants whose values are known by the program when it runs the algorithm, and the actual variables to value are the x(.).


I am a bit surprised since the system is rather small, and since I previously obtained convergence very easily with a very similar system. According to my thesis supervisor, the system should admit a solution.

Then my question is: how can i solve this system in the end? Is there a way to implement a loop that would create random initial values, so that in the end one of these random sets could succeed to carry the solution? Is there a way to compel the function to stop to a global min, and not a local min? Should I try a different function for solving?

Thanks a lot for any help.

Subject: System of nonlinear equations: no convergence to a root using fsolve

From: Matt J

Date: 8 Jul, 2011 17:33:49

Message: 2 of 3

"Romain " <romain_leg@yahoo.fr> wrote in message <iv7cr9$aqv$1@newscl01ah.mathworks.com>...
>>
> F(1)=x(1)^2+x(2)^2+x(3)^2-EXO_SIGMA1SQ;
> F(2)=x(4)^2+x(5)^2+x(6)^2-EXO_SIGMA2SQ;
> F(3)=x(7)^2+x(8)^2-EXO_SIGMA3SQ;
> F(4)=x(1)*x(4)+x(2)*x(5)+x(3)*x(6)-EXO_SIGMA12;
> F(5)=x(2)*x(7)+x(3)*x(8)-EXO_SIGMA13;
> F(6)=x(5)*x(7)+x(6)*x(8)-EXO_SIGMA23;
> F(7)=x(2)*EXO_K1+x(5)*EXO_K2+x(7);
> F(8)=x(3)*EXO_K1+x(6)*EXO_K2+x(8);
> The EXO variables are constants whose values are known by the program when it runs the algorithm, and the actual variables to value are the x(.).
>
>
> I am a bit surprised since the system is rather small, and since I previously obtained convergence very easily with a very similar system. According to my thesis supervisor, the system should admit a solution.
===================

Well, it's pretty clear that the system can fail to have a solution. Your very first equation, for example, requires that

F(1)+EXO_SIGMA1SQ >=0

and similarly with your 2nd and third equation. If that's not satisifed, then right away you know a solution does not exist.

If that's not the problem, your first 3 equations provide a clue to where a solution lies, if it does exist. The first equation implies, for example, that

abs(x(i)) <= sqrt(F(1)+EXO_SIGMA1SQ)

for i=1,2,3. The 2nd and 3rd equations provide similar bounds/ranges for the
other x(i).


To search for the global minimum, one thing you could try is to coarsely discretize the above ranges for x(i), into e.g. 5 bins. Then you could do an exhaustive search over all combinations of those values to see which most nearly solves the equation. That would at least give you some idea where to initialize.

Subject: System of nonlinear equations: no convergence to a root using fsolve

From: Roger Stafford

Date: 8 Jul, 2011 20:51:09

Message: 3 of 3

"Romain " <romain_leg@yahoo.fr> wrote in message <iv7cr9$aqv$1@newscl01ah.mathworks.com>...
> Hello everybody,
>
> I have a problem using the fsolve function. The aim of the procedure I implement is to identify a matrix subject to certain restrictions. To do so, I can decompose my matrix into a nonlinear system of equations. It is a rather small system (8 equations, 8 unknown), however, when I use the fsolve function, I always obtain the error message:'Optimizer appears to be converging to a minimum that is not a root:Sum of squares of the function values exceeds the square root of options.Tolfun.Try again with a new starting point'. I tried with many different initial values, but that was no improvement. Precisely, here is my system:
>
> F(1)=x(1)^2+x(2)^2+x(3)^2-EXO_SIGMA1SQ;
> F(2)=x(4)^2+x(5)^2+x(6)^2-EXO_SIGMA2SQ;
> F(3)=x(7)^2+x(8)^2-EXO_SIGMA3SQ;
> F(4)=x(1)*x(4)+x(2)*x(5)+x(3)*x(6)-EXO_SIGMA12;
> F(5)=x(2)*x(7)+x(3)*x(8)-EXO_SIGMA13;
> F(6)=x(5)*x(7)+x(6)*x(8)-EXO_SIGMA23;
> F(7)=x(2)*EXO_K1+x(5)*EXO_K2+x(7);
> F(8)=x(3)*EXO_K1+x(6)*EXO_K2+x(8);
> The EXO variables are constants whose values are known by the program when it runs the algorithm, and the actual variables to value are the x(.).
>
>
> I am a bit surprised since the system is rather small, and since I previously obtained convergence very easily with a very similar system. According to my thesis supervisor, the system should admit a solution.
>
> Then my question is: how can i solve this system in the end? Is there a way to implement a loop that would create random initial values, so that in the end one of these random sets could succeed to carry the solution? Is there a way to compel the function to stop to a global min, and not a local min? Should I try a different function for solving?
>
> Thanks a lot for any help.
- - - - - - - - - -
  I agree with Matt and disagree with your advisor. It is easy to furnish fsolve with parameter values that make a real solution impossible no matter what initial estimate you use. For example,

 F(1+F(2)-2*F(4) = (x(1)-x(4))^2+(x(2)-x(5))^2+(x(3)-x(6))^2 ...
              - (EXO_SIGMA1SQ+EXO_SIGMA2SQ-2*EXO_SIGMA12)

If the second line happens to be the wrong sign, no real solution can exist even though each of the three separate EXO quantities is positive.

  I would venture the guess that there are many combinations of values in these eight parameters that would make a solution impossible. Your task would be to restrict yourself to those that do allow a solution. This is quite aside from the problem of what initial estimate to use in fsolve.

Roger Stafford

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us