No solution found when solving 3 non linear equations

조회 수: 5 (최근 30일)
Manqoba Mazibuko
Manqoba Mazibuko 2020년 1월 21일
댓글: Walter Roberson 2020년 1월 28일
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
Walter Roberson
Walter Roberson 2020년 1월 21일
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 2020년 1월 21일
Thank you I just did that. They are inconsistent. Thank you for the help, really appreciate it!!!

댓글을 달려면 로그인하십시오.

채택된 답변

Matt J
Matt J 2020년 1월 21일
편집: Matt J 2020년 1월 21일
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

추가 답변 (1개)

Alex Sha
Alex Sha 2020년 1월 28일
편집: Alex Sha 2020년 1월 28일
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
Matt J
Matt J 2020년 1월 28일
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 2020년 1월 28일
With that range of values, some of your x are within eps() of the others and so the additions lose precision.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by