How to Supply the Jacobian to Fsolve?

42 views (last 30 days)
Pablo
Pablo on 18 Nov 2014
Answered: Alan Weiss on 18 Nov 2014
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?

Answers (1)

Alan Weiss
Alan Weiss on 18 Nov 2014
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

Products

Community Treasure Hunt

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

Start Hunting!