singular Jacobian encountered in bvp4c

1 view (last 30 days)
sam4527
sam4527 on 26 Apr 2011
Hello,
I use "bvp4c" command for solving a ODE system,
I encounter the following problem:
??? Error using ==> bvp4c
Unable to solve The collocation equations - a singular Jacobian encountered
Is there someone who knows a method or solution. My code is, as follows:
function [phi90,phivarrho,phiteta]=phiFn(a,S90,Svarrho,coeff)
c1=coeff(1); c2=coeff(2); c3=coeff(3); c4=coeff(4); c5=coeff(5); c6=coeff(6); c7=coeff(7); c8=coeff(8); c9=coeff(9);
options=[];
xinit1= linspace(-a/2,0);
xinit2=linspace(0,a/2);
xinit=[xinit1,xinit2];
yinit=[1 ;0; 0; -c7*c1; 1; 0; 0; -c7*c1];
solinit= bvpinit(xinit,yinit);
sol = bvp4c(@ode1,@BCs,solinit,options,S90,Svarrho,coeff)
xint=sol.x;
yint=sol.y;
phi90=yint(1,:);
phivarrho=yint(5,:);
phiteta=-(2*phi90+phivarrho);
function odesys = ode1(x,y,region,S90,Svarrho,coeff)
c1=coeff(1); c2=coeff(2); c3=coeff(3); c4=coeff(4);
c5=coeff(5); c6=coeff(6); c7=coeff(7); c8=coeff(8);
c9=coeff(9);
switch region
case 1 % x in [-a/2 0]
odesys = [ y(2);y(3);y(4);
(c6*c3*y(3)+c7*c3*y(1)+c9*c3*y(7)-c8*c2*y(3)-
c8*c4*y(7))/(-c5*c3+c1*c8);
y(6);y(7);y(8);(-c6*c3*y(3)-c7*c1*y(1)-
c9*c1*y(7)+c5*c2*y(3)+c5*c4*y(7))/(-c5*c3+c1*c8)];
case 2 % x in [0 a/2]
odesys = [ y(2);y(3);y(4);
(c6*c3*y(3)+c7*c3*y(1)+c9*c3*y(7)-c8*c2*y(3)-
c8*c4*y(7))/(-c5*c3+c1*c8);
y(6);y(7);y(8);(-c6*c3*y(3)-c7*c1*y(1)-
c9*c1*y(7)+c5*c2*y(3)+c5*c4*y(7))/(-c5*c3+c1*c8)];
end
end
function res = BCs(YL,YR,S90,Svarrho,coeff)
res = [YL(1,1)-S90;
YR(1,1)-S90;
YL(1,2)-S90;
YR(1,2)-S90;
YL(2,1);
YR(2,1);
YL(2,2);
YR(2,2);
YL(5,1)- Svarrho;
YR(5,1)-YL(5,2);
YL(5,2)-YR(5,1);
YR(5,2)-Svarrho;
YL(6,1);
YR(6,1)-YL(6,2);
YL(6,2)-YR(6,1);
YR(6,2)];
end
end
thank you
  1 Comment
Walter Roberson
Walter Roberson on 28 Apr 2011
See http://www.mathworks.com/matlabcentral/answers/6369-bvp4c

Sign in to comment.

Answers (2)

Zeynab Mousavi.K
Zeynab Mousavi.K on 28 Apr 2011
oooooooo i have the same problem with exactly the same error if you understood the answer please inform me and i will tell you any solution if i found
  2 Comments
Amir K Neghab
Amir K Neghab on 17 Nov 2011
Hi,
Have you found the error? I think so.
How can you solve the " Singular Jacobian Error"
Walter Roberson
Walter Roberson on 17 Nov 2011
Amir, did you follow the link in my Comment, and try the Singular option?

Sign in to comment.


Zachary
Zachary on 22 Oct 2012
Being that there are no 1/x terms in your odes we need to see your coeff function to determine if it contributes to the singular jacobian.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!