How to Supply the Jacobian to Fsolve?

26 次查看(过去 30 天)
Pablo
Pablo 2014-11-18
回答: Alan Weiss 2014-11-18
pow=fsolve(@eqns,pop);
This is the code I am using to solve a 2x2 non-linear system of equations, defined in the function eqns.m.
pop is a 2x1 initialisation vector pretty close to the solution. When I run it, the output says
No solution found.
fsolve stopped because the relative size of the current step is less than the
default value of the step size tolerance squared, but the vector of function values
is not near zero as measured by the default value of the function tolerance.
<stopping criteria details>
Any way out? I tried moving the initial point further away from the solution intentionally, still it is not working. How do I set the tolerance or some other parameter? Some posts gave me the impression that supplying the jacobian to matlab can be helpful, but how do I do that? Please note that I need the solution in the form of a code which I can put in a function file to be called repeatedly. I believe the interactive optimtool toolbox would not help here. Any help please?

回答(1 个)

Alan Weiss
Alan Weiss 2014-11-18
Here is an example of a nonlinear equation being solved with its Jacobian.
If you want or need to use symbolic math to calculate the Jacobian, see this example.
Alan Weiss
MATLAB mathematical toolbox documentation

类别

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