BVP4C: Error: Unable to solve the collocation equations -- a singular Jacobian encountered

Hello, I am facing "Unable to solve the collocation equations -- a singular Jacobian encountered" error using BVP4C function.Below are the details:
function Pearsonproblem
options = bvpset('NMax',1000000); M=50;
solinit = bvpinit(linspace(0,10,10000),[0 0 1 1 1 1],M);
sol = bvp4c(@fourode,@fourbc,solinit,options);
save hatimsol.mat sol
x = linspace(0,1);
y = deval(sol,x);
plot(x,y(1:3,:))
%
function dydx = fourode(x,y,M)
k=2;
dydx = [ y(2); y(3); y(4); -(k^4)*y(1)+2*k^2*y(3); y(6); k^2*y(5)-y(1)];
%
function res = fourbc(ya,yb,M)
e=0;
k=2;
res = [ ya(1); ya(2); ya(5); yb(1); yb(3)/((k^2)*yb(5))+M; yb(6)+e*k*yb(5);ya(3) ];
Please help me resolve this error. Thanks.

 Risposta accettata

6 equations - 6 boundary conditions, not 7.
Best wishes
Torsten

4 Commenti

M is unknown in boundray condition and so we need one more boundry condition.
If M is not used in "dydx", you need 6, not 7 boundary conditions.
Best wishes
Torsten.
Yes, There is no M in "dydx", but when I remove one condition from "function res = fourbc(ya,yb,M)" I get this error: Error using bvparguments (line 111) Error in calling BVP4C(ODEFUN,BCFUN,SOLINIT,OPTIONS): The boundary condition function BCFUN should return a column vector of length 7.
Yes, you will have to remove M from the list of transfered parameters and set M explicitly to a value if you didn't remove the boundary condition containing M.
Best wishes
Torsten.

Accedi per commentare.

Più risposte (0)

Tag

Non è stata ancora inserito alcun tag.

Community Treasure Hunt

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

Start Hunting!

Translated by