No solution found when solving 3 non linear equations

5 visualizaciones (últimos 30 días)
Manqoba Mazibuko
Manqoba Mazibuko el 21 de En. de 2020
Comentada: Walter Roberson el 28 de En. de 2020
Good day every one
I have been trying to sove 3 non linear equations but i am "No solution found" report.
The code is as follows
I defined a function containing the 3 non linear equations in an mfile called "angle"
function F=myfunction(x)
F(1)=cos(-x(1)+x(2))+cos(-x(1)+x(3));
F(2)=cos(-x(2)+x(1))+cos(-x(2)+x(3));
F(3)=cos(-x(3)+x(1))+cos(-x(3)+x(2));
After running code
deltarad=fsolve(@yyyyy,rand([3 1]))
I get the following report
No solution found.
fsolve stopped because the problem appears regular as measured by the gradient,
but the vector of function values is not near zero as measured by the
default value of the function tolerance.
<stopping criteria details>
deltarad =
-60.5208
-62.8602
-61.6905
fsolve stopped because the sum of squared function values, r, has gradient with
relative norm 7.341307e-07; this is less than options.OptimalityTolerance = 1.000000e-06.
However, r = 7.954251e-01, exceeds sqrt(options.FunctionTolerance) = 1.000000e-03.
Optimization Metric Options
norm(grad r) = 7.34e-07 OptimalityTolerance = 1e-06 (default)
r = 7.95e-01 sqrt(FunctionTolerance) = 1.0e-03 (default)
  4 comentarios
Walter Roberson
Walter Roberson el 21 de En. de 2020
Solve any two of them for two of the variables. Substitute into the third. Observe that the result is something that cannot be 0.
Manqoba Mazibuko
Manqoba Mazibuko el 21 de En. de 2020
Thank you I just did that. They are inconsistent. Thank you for the help, really appreciate it!!!

Iniciar sesión para comentar.

Respuesta aceptada

Matt J
Matt J el 21 de En. de 2020
Editada: Matt J el 21 de En. de 2020
A numerical sweep also gives evidence that there is no solution
[x1,x2,x3]=ndgrid(linspace(-pi,+pi,512));
F1=cos(-x1+x2)+cos(-x1+x3);
F2=cos(-x2+x1)+cos(-x2+x3);
F3=cos(-x3+x1)+cos(-x3+x2);
F=[abs(F1(:)), abs(F2(:)), abs(F3(:))];
Fmin = min(sum(F,2))
Fmin =
1.0142

Más respuestas (1)

Alex Sha
Alex Sha el 28 de En. de 2020
Editada: Alex Sha el 28 de En. de 2020
Hi, all, how about the solutions below, from the numerical perspective:
1:
x1: -5.21219473201765E21
x2: -0.279500437676178
x3: 1.29129588911872
Fevl:
f1=0
f2=-1.4930819167841E-15
f3=-1.4930819167841E-15
2:
x1: -1.79664678356017E21
x2: 2.02595283616513
x3: 3.59674916296003
Fevl:
f1=0
f2=-3.04739415125932E-15
f3=-3.04739415125932E-15
3:
x1: 2.19768008763813
x2: 5.41140930100612E22
x3: 0.626883760843237
Fevl:
f1=3.61394399649162E-15
f2=0
f3=3.61394399649162E-15
  2 comentarios
Matt J
Matt J el 28 de En. de 2020
I can't reproduce your f values
x1= -5.21219473201765E21
x2= -0.279500437676178
x3= 1.29129588911872
F1=cos(-x1+x2)+cos(-x1+x3)
F2=cos(-x2+x1)+cos(-x2+x3)
F3=cos(-x3+x1)+cos(-x3+x2)
F1 =
-0.2352
F2 =
-0.1176
F3 =
-0.1176
Walter Roberson
Walter Roberson el 28 de En. de 2020
With that range of values, some of your x are within eps() of the others and so the additions lose precision.

Iniciar sesión para comentar.

Categorías

Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by