Error using bvp4c (line 251) : Unable to solve the collocation equations -- a singular Jacobian encountered

The differential equation goes as depicted in the image
This is my code:
f = @(x,y) [y(2); (4*x*y(1)-((0.14*2*x)*(y(2))))/(0.14*x-x^2)];
bc = @(ya, yb) [ya(1)-500; yb(2)];
xmesh = linspace(0.1,0.14,100);
solinit = bvpinit(xmesh, [0 1]);
sol = bvp4c(f, bc, solinit);
figure;
plot(sol.x,sol.y);
I am unsure if the intitial guess is correct and maybe that is causing the problem. Please help me out.
Thanks !

2 Comments

  1. In your function definition: 0.14-2*x instead of 0.14*2*x
  2. Integrate up to 0.139 instead of 0.14. Otherwise, you will divide by zero.

Sign in to comment.

Answers (0)

Asked:

on 30 May 2021

Commented:

on 30 May 2021

Community Treasure Hunt

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

Start Hunting!