Clear Filters
Clear Filters

this code through this error." Unable to solve the collocation equations -- a singular Jacobian encountered. how to solve this

1 view (last 30 days)
function maxwell
global M sigma delta E Nb Nt A zeta Pr Ec lembta Le n;
sigma=0.1;delta=1;E=0.1;Nb=1;Nt=1; A=2;zeta=0.1; Pr=6.2;Ec=1;lembta=1;Le=1;n=1;
infinity=3;
Mva=[0.1 0.2 0.3];
for i=1:3
M=Mva(i);
lines={'-g','-r','-k'};
solinit = bvpinit(linspace(0,infinity,40),[0 0 1 0 1 0 1]);
sol = bvp4c(@shootode,@shootbc,solinit);
eta = sol.x;
f = sol.y;
figure(1)
plot(eta,f(2,:),lines{i},'linewidth',1.5)
xlabel('\eta')
ylabel('\theta(\eta)');
hold on
end
function dydx=shootode(~,f)
global M sigma E delta Nb Nt A zeta Pr Ec lembta Le n;
dydx=zeros(7,1);
dydx(1)= f(2);
dydx(2)= f(3);
dydx(3)= (M*(f(2)-lembta*f(1)*f(3))-2*lembta*f(1)*f(2)*f(3)-f(1)*f(3)+f(2)*f(2)+A*((zeta/2)*f(3)+f(2)))/(1-lembta*f(1)*f(1));
dydx(4)= f(5);
dydx(5)= Pr*(Nb*f(5)*f(7)-Ec*(f(3)*f(3)-2*lembta*f(1)*f(2)*f(3)-lembta*f(1)*f(1)*f(3)*f(3))-Nt*f(5)*f(5)-M*Ec*(f(2)-lembta*f(1)*f(3))*(f(2)-lembta*f(1)*f(3))-f(1)*f(5)+2*f(2)*f(4)+(A/2)*(3*f(4)+zeta*f(5)));
dydx(6)= f(7);
dydx(7)= (2*f(2)*f(6)+(A/2)*(3*f(6)+zeta*f(7))-(1/Le)*(Nt/Nb)*dydx(5)-sigma*((1+delta*f(5))^n)*exp(E/(1+delta*f(5)))*f(6));
function res =shootbc(fa,fb)
global val bta A;
bta=3; A=0.1;
val=(bta*A)/2;
res = [
fa(2)-1;
fa(1)-0;
fa(4)-1;
fb(3)-0;
fb(5)-0;
fb(7)-0;
fb(1)+val;
];
  3 Comments

Sign in to comment.

Accepted Answer

Gowthami
Gowthami on 24 Jan 2023
Hi,
It is my understanding that you are receiving an error about a 'singular Jacobian' when you use the BVP4C function within MATLAB.
I recommend you go through the workarounds mentioned in the following MATLAB Answer:

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!