Solve system of boundary value problem (a singular Jacobian encountered)

7 views (last 30 days)
Hi everyone,
I have been stuck for few days with finding numerical solution for next problem :
%ODE Function
f=@(t,y) [-2*y(1)
y(2)
-(y(5))^2+(y(1))^2+y(2)*y(4)
y(3)
2*(y(1))*(y(5))+(y(4)*y(3))
2*(y(1))*(y(4))-2*(y(2))
];
%BC Function
bc=@(ya,yb) [ya(1)
ya(4)
ya(5)-1
ya(6)
yb(1)
yb(5)];
%Initional Solution
solinit=bvpinit(linspace(0,50,50),[1 0 1 0 1 0]);
%Solve the BVP
sol=bvp4c(f,bc,solinit);
and i facing whit this error:
Error using bvp4c (line 251)
Unable to solve the collocation equations -- a singular Jacobian encountered.
Error in last (line 19)
sol=bvp4c(f,bc,solinit);

Answers (2)

J. Alex Lee
J. Alex Lee on 28 Jan 2020
If you know the problem is solvable (HW, e.g.,), then singular Jacobian usually means something is wrong with your equations or BCs (it means linearized equations at some step doesn't have full rank so it's unsolvable). In general it could also mean you are trying to solve the system at a critical point.
First, let's look at your odefun, which if you break it out looks like this
dy(1) = -2*y(1)
dy(2) = y(2)
dy(3) = -(y(5))^2+(y(1))^2+y(2)*y(4)
dy(4) = y(3)
dy(5) = 2*(y(1))*(y(5))+(y(4)*y(3))
dy(6) = 2*(y(1))*(y(4))-2*(y(2))
It means that if F=y(1) (looking at RHS of first equation), then I think you are trying to assert , so your odefun is returning "equations" out of order
Let's do the following:
% F = y(1)
% G = y(2)
% H = y(3)
% P = y(4)
% F'= y(5)
% G'= y(6)
dy(1) = y(5) % F' = F'
dy(2) = y(6) % G' = G'
dy(3) = -2*y(1) % H' = -2F
dy(4) = -2*y(1)*y(3) - 2*y(5) % -2FH - 2F'
dy(5) = -y(2)^2 - y(1)^2 + y(5)*y(3) % -G^2 - F^2 + F'H
dy(6) = 2*y(1)*y(2) + y(3)*y(6) % 2FG + HG'
And of course you will have to change your boundary conditions to match
I'm also curious how you will deal with the infinite boundary on the right.
  4 Comments
J. Alex Lee
J. Alex Lee on 28 Jan 2020
What do your final list of equations look like once you correct your BCs? Are your BC equations in the correct order?
If so, take another look at your initialization. bvpinit() documentation tells you what is the meaning of your yinit input. Is the initial solution guess generated consistent with your BCs?
The next question is more subtle: does the nature of your initial solution guess "break" your solver in some way? It can be expected that uniform solutions can give you issues when it comes time to solve, because with differential equations, that leads to a lot of zeros.

Sign in to comment.


Ala Moradian
Ala Moradian on 13 Nov 2021
Pouya Ra - Did you haev any success? I am solving this sam set of ODE (for von Karman problem). Appreciate learning how you ended up fixing the error.

Tags

Community Treasure Hunt

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

Start Hunting!