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

조회 수: 1 (최근 30일)
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
REVATHI DEVI
REVATHI DEVI 2023년 1월 20일
A is 0.1 only.. why it shows this error if i correct that also showing error
Torsten
Torsten 2023년 1월 20일
편집: Torsten 2023년 1월 20일
So you want to say that correcting obvious errors is not important ?

댓글을 달려면 로그인하십시오.

채택된 답변

Gowthami
Gowthami 2023년 1월 24일
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:

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Boundary Value Problems에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by