Error using bvp4c (singular jacobian encountered)

How can I find the error in this MATLAB's script?
Script one: perfiles_thiele
clc; clear;
R=3;%input('Radio de particula en mm, R: ');
%%BVP solution problem
C0=2E-4;
dCdr0=0.016;
solinit = bvpinit(linspace(0,R,100),[C0 dCdr0]);
sol = bvp4c(@model,@ex1bc,solinit);
r =sol.x;
C=sol.y(1,:);
v=sol.y(2,:);
TWO:
function F =model(r,Y)
R=3;
Thiele =1;
C=Y(1);
v=Y(2);
dCdr= v;
dvdr= (-2/r)*v + C*9*Thiele^2/R^2;
F = [dCdr; dvdr];
end
THREE:
function res = ex1bc(ya,yb)
Cs=2E-6;
dCdr=0;
res = [ ya(1) - Cs
yb(2) - dCdr];
end
When I run the script one throws me the error:
Error using bvp4c (line 251)
Unable to solve the collocation equations -- a singular Jacobian encountered.
Error in perfiles_thiele (line 19)
sol = bvp4c(@model,@ex1bc,solinit);
I appreciate help to know if the problem is the definition of [C0 dCdr0] or if it is because I have some error in my BVP system.
Thanks!

1 件のコメント

Walter Roberson
Walter Roberson 2018 年 10 月 18 日
As we only have your code and not your equations, we cannot compare to determine if there is a problem.

サインインしてコメントする。

 採用された回答

Torsten
Torsten 2018 年 10 月 18 日

0 投票

Don't start at r = 0, but at r = a small number.
Best wishes
Torsten.

その他の回答 (1 件)

CLMSP
CLMSP 2018 年 10 月 18 日

0 投票

Clear! thank you!

2 件のコメント

MOSLI KARIM
MOSLI KARIM 2023 年 11 月 7 日
%%
function solved
clc; clear;
global Thiele Cs R C0 dCdr0
Cs=2E-6
Thiele =1
R=3;%input('Radio de particula en mm, R: ');
%%BVP solution problem
C0=2E-4;
dCdr0=0.016;
solinit = bvpinit(linspace(0.01,R,100),[C0 dCdr0]);
sol = bvp4c(@model,@ex1bc,solinit);
RR=sol.x'
display(RR)
C=sol.y(1,:);
v=sol.y(2,:);
figure(1)
plot(RR,C)
figure(2)
plot(RR,v)
function F =model(r,Y)
C=Y(1);
v=Y(2);
dCdr= v;
dvdr= (-2/r)*v + C*9*Thiele^2/R^2;
F = [dCdr; dvdr];
end
function res = ex1bc(ya,yb)
res = [ ya(1) - Cs
yb(2) ];
end
end
MOSLI KARIM
MOSLI KARIM 2023 年 11 月 7 日
your code works well, I just made x=a=0.001 to avoid the singularity

サインインしてコメントする。

カテゴリ

タグ

質問済み:

2018 年 10 月 18 日

コメント済み:

2023 年 11 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by