MATLAB Answers

Why do I receive an error about a "singular Jacobian" when I use the BVP4C function within MATLAB?

227 views (last 30 days)
I am trying to solve a boundary value problem, but receive the error:
ERROR: ??? Error using ==> bvp4c
Unable to solve the collocation equations --
a singular Jacobian encountered

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 30 Mar 2021
Edited: MathWorks Support Team on 1 Apr 2021
A singular Jacobian indicates that the initial guess causes the solution to diverge. The BVP4C function finds the solution by solving a system of nonlinear algebraic equations. Nonlinear solvers are only as effective as the initial guess they start with, so changing your starting guess may help. Also, BVP4C is responsible for providing a guess for the solution from one iteration to another.
There might be several things going wrong with this problem:
1) The problem could be posed incorrectly, either in its mathematical formulation or due to a coding error. It is easy to come up with a BVP that has no solution, or one that has an infinite number of solutions.
2) The initial guess, which you specify, may not be sufficient to produce convergence. This is particularly true for difficult problems, such as those where the solution has sharp changes or discontinuities.
3) BVP4C may converge for first few iterations, but at some point, become unable to provide a next guess that will be sufficient to find the solution.
The first thing to do is examine the problem and its coding, then try different initial guesses and/or tolerances.
If this does not help, keep in mind that solving BVPs is more an art than science -- there are several 'tricks' that sometimes allow you to solve 'difficult' problems. You can refer to the following link for an example of the process for solving BVPs using BVP4C:
Additionally, BVP4C is just one choice for solving a BVP in MATLAB. Therefore, you may consider using, for example, SBVP, a similar solver available from MATLAB Central at:
Note that MathWorks does not guarantee or warrant the use or content of these submissions.
Any questions, issues, or complaints should be directed to the contributing author.
One last thing to try might be an ad hoc shooting method, which can be done by wrapping a nonlinear algebraic solver around an initial value problem ODE solver such as ODE45 or ODE23.
  3 Comments
Shweta Singh
Shweta Singh on 4 May 2020
Hi,
For any further questions or clarification, feel free to contact MathWorks Technical Support by using the following link:
Thanks,
Shweta Singh

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!