Hi,
I understand that you are attempting to solve the problem described in the article using the 'bvp5c' solver. You are encountering a warning and obtaining incorrect results for larger values of 'alpha'. I assume that you are achieving correct results for smaller values of 'alpha' and have already tried scaling the boundary values. Additionally, I am not certain what constitutes large values of 'alpha' in this context, so I assume values above 100 to be large.
In my knowledge, the warning message you are encountering suggests that the Jacobian matrix in your boundary value problem solver is becoming ill-conditioned, which can lead to inaccurate results. This issue often arises in stiff problems or when the parameters of the problem cause the solution to vary rapidly.
Here are a few suggestions to help mitigate this issue:
- Refine the Mesh: Increase the number of points in the mesh to provide a better initial guess and more resolution for the solver.
- Adjust Tolerances: Tighten the tolerances in bvpset to improve accuracy.
- Initial Guess: Provide a better initial guess for the solution to help the solver converge more reliably.
Here's an example of how you might modify your code to refine the mesh and adjust tolerances :
eigenvalues0999 = zeros(1, 30);
options = bvpset('RelTol',1e-7,'AbsTol',1e-7,'NMax',50000);
solinit = bvpinit(linspace(-3, 6, 50000), @mat4init, Psi1);
sol = bvp5c(@mat4ode, @mat4bc, solinit, options);
eigenvalues0999(1, i) = sol.parameters;
The modifications made to the code are :
- Refined Mesh: Increased the number of points in the mesh from 30,000 to 50,000.
- Tighter Tolerances: Changed the relative and absolute tolerances in bvpset from 1e-5 to 1e-7.
- Increased NMax: Increased the maximum number of mesh points (NMax) to allow the solver more flexibility.
I hope this gives you a direction for taking the next steps to resolve the issue.