I would like to add one more thing. This might occur because I call a Fortran subroutine in the equations.
fsolve returns a strange value
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to solve two non-linear equations with two unknowns, using fsolve. Let me call the system of equations "PFI." When I just take the value of the equation at each x, say y=PFI(x), it returns values like [-1.5,-0.7]. This is not the root, but looks legit. However, when I use fsolve by writing [x0,y,exitflag1]=fsolve(@(x)PFI(x),x0,options), MATLAB returns the following:
[x0,y,exitflag1]=fsolve(@(x)PFI(x),x0,options)
Norm of First-order Trust-region
Iteration Func-count f(x) step optimality radius
0 3 3.49367e+23 0 1
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
selected value of the function tolerance.
<stopping criteria details>
x0 =
1.0000
0.1500
y =
1.0e+11 *
5.9107
0.0000
exitflag1 =
-2
I wonder why f(x) is so huge, and the first-order optimality is zero. The gradient at the initial point is not zero. I would appreciate it any comments. Thank you.
Respuestas (1)
Walter Roberson
el 27 de En. de 2016
fsolve has to invent new points to evaluate at. In the course of doing that, it has encountered a singularity. You probably need to be solving over a bounded region, but fsolve does not permit constraints.
You should be turning on Diagnostics and FunValCheck in the options structure.
2 comentarios
Walter Roberson
el 27 de En. de 2016
That sounds as if your Fortran code might have an uninitialized variable.
Ver también
Categorías
Más información sobre Fortran with MATLAB en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!