How to solve singularity problem while using fsolve

조회 수: 6 (최근 30일)
KB
KB 2016년 5월 26일
답변: Walter Roberson 2016년 5월 26일
Hi,I am trying to solve for x in a equation using fsolve. Below is the code and equation:
a = 0.1886;
b = 0.6886;
c = 1.1886;
m = 0.31372;
x0 = 0.1;
F = @(x)[(((x-a)/(x-c))^(m))+((x-a)/(x-b))];
options = optimset('Display','iter','MaxFunEvals',1e20,'TolFun',2e-50,'TolX',2e-50);
[xd, fval, exitflag, output]= fsolve(F, x0, options)
However, I am getting 'No solution found' with a message: fsolve stopped because the problem appears to be locally singular. I have tried changing the options parameters and initial guess still getting same output. Any help is appreciated.
Thanks, KB

채택된 답변

John BG
John BG 2016년 5월 26일
Try splitting the fsolve approach with real() and imag() because with real() i get something:
..
F = @(x)[real(((x-a)/(x-c))^(m))+((x-a)/(x-b))];
..
[xd, fval, exitflag, output]= fsolve(F, x0, options)
Norm of First-order Trust-region
Iteration Func-count f(x) step optimality radius
0 2 0.366931 1.77 1
1 4 0.000271336 0.207172 0.0421 1
2 6 2.03148e-07 0.00645204 0.00109 1
3 8 1.38596e-13 0.000186725 8.97e-07 1
4 10 7.81816e-26 1.54486e-07 6.74e-13 1
5 12 3.08149e-33 1.16029e-13 1.34e-16 1
Equation solved, inaccuracy possible.
The vector of function values is near zero, as measured by the selected value
of the function tolerance. However, the last step was ineffective.
<stopping criteria details>
xd =
0.30
fval =
-0.00
exitflag =
3.00
output =
iterations: 5.00
funcCount: 12.00
algorithm: 'trust-region-dogleg'
firstorderopt: 0.00
message: 'Equation solved, inaccuracy possible.…'
repeat for the imag() part.
Or alternatively use abs() and arg()
all together, you should catch at least 2 poles on b and c.
If you find this answer of any help solving your question,
please click on the thumbs-up vote link,
thanks in advance
John

추가 답변 (1개)

Walter Roberson
Walter Roberson 2016년 5월 26일
x = 943/5000
The equation is exactly 0 at that point, which corresponds to x = a . However, there is no zero crossing because it goes imaginary until x = c at which point it slopes down from infinity towards 2 (and so never crosses 0 for greater x either)

카테고리

Help CenterFile Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by