Coupled Mass and energy equations using bvp4c
이전 댓글 표시

clc,clear,close
global Pem Peh Da b U yw yf
Pem = 2000; Peh = 500;
Da = 1e8; b = 0.015;
U = 1; yw = 0.9; yf = 0.0503;
z = linspace(0,1);
%guess = 4*ones(1,2);
solinit = bvpinit(z,[1,0,1,0]);
sol = bvp4c(@myfun,@mybc,solinit);
function F = myfun(~,y)
global Pem Peh Da b U yw
y1 = y(1);
y2 = y(2);
y3 = y(3);
y4 = y(4);
F(1) = y2;
F(2) = Peh*(y2 + b*Da*y3*exp(-1/y1) - U*(yw-y1));
F(3) = y4;
F(4) = Pem*(y4 + Da*y3*exp(-1/y1));
F = F(:);
end
function f = mybc(ya,yb)
global Pem Peh yf
f(1) = ya(2)+Peh*(yf-ya(1));
f(2) = yb(2);
f(3) = ya(4) + Pem*(1-ya(3));
f(4) = yb(4);
f=f(:);
end
function g = guess(z) % initial guess for y and y'
g = [0.5
0.5
0.5
0.5];
end
I wrote code like this but I'm getting error as
Error using bvp4c (line 248)
Unable to solve the collocation equations -- a singular Jacobian encountered.
Error in Q2 (line 11)
sol = bvp4c(@myfun,@mybc,solinit)
can someone help in this regard
thanks in advance
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Boundary Value Problems에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
