Code keeps on running. Neither shows error nor gets executed.
조회 수: 1(최근 30일)
표시 이전 댓글
In order to check the progress, I have added display functions. It runs till "set1 over". Then it neither shows error nor completes execution.
Instead of running it as a file alone, I also tried to directly execute in the command window. I executed till "set1 over" in command window and then tried to execute the next "set2 over" part only. Even then it kept on running.
display ("constants over");
syms xv(t) glc(t) gln(t) lac(t) amm(t) mab(t) V(t)
mu = mumax*(glc*gln/((kglc+glc)*(kgln+gln))) ;
kd = (kdmax/(mumax-kdlac*lac))*(1/(mumax-kdamm*amm))*(kdgln/(kdgln+gln));
qglc = mu/yxvglc+(mglc*(glc/kmglc+glc));
qgln = mu/yxvgln;
qlac = ylacglc*qglc;
qamm = yammgln*qgln;
qmab = a0*mu/(kmu+mu)+b;
display ("basic eaquations over ");
dV = diff(V(t),t) == F1+F2;
cV = V(0) ==0.8;
V = dsolve(dV, cV);
display ("set1 over");
dxv = diff(xv(t),t) == (mu-kd)*xv-(F1+F2)*xv/V;
cxv= xv(0) == 2.0*10^8;
xv = dsolve(dxv, cxv);
display ("set2 over");
dglc = diff(glc(t),t) == F1*glcin/V-(((F1+F2)/V)*(glc-qglc*xv));
cglc= glc(0) == 25;
glc = dsolve(dglc, cglc);
display ("set3 over");
dgln= diff(gln(t),t) == F2*glnin/V-(((F1+F2)/V)*(gln-qgln*xv));
cgln= gln(0) == 4;
gln = dsolve(dgln, cgln);
display ("set4 over");
dlac =diff(lac(t),t) == qlac*xv-(F1+F2)*lac/V;
clac= lac(0) == 0;
lac = dsolve(dlac, clac);
display ("set5 over");
damm =diff(amm(t),t) == qamm*xv-(F1+F2)*amm/V;
camm= amm(0) == 0;
amm = dsolve(damm, camm);
display ("set6 over");
dmab =diff( mab(t),t) == qmab*xv-(F1+F2)*mab/V;
cmab= mab(0) == 0;
mab = dsolve(dmab, cmab);
display ("set7 - final set over");
display ("entering final part");
J = int(L,t,0,tf);
display ("end; Thank You");
댓글 수: 0
Raunak Gupta 2020년 9월 30일
From the code I see the differential equation after the “set1 over” comment is dependent on variables gln(t) and glc(t). Since these two variables are not solved first (if you see variable V(t) is solved before set1 over comment) before using them, dsolve is not able to find the expression of gln and glc to replace into the solution of dxv differential equation. Even if you use solve instead of dsolve it will through error like “Warning: Unable to find explicit solution. For options, see help.”
So as a rule of thumb I would recommend giving the differential equation only dependent on variable “t”. If you use any other unsolved variable, then dsolve will not provide the solution.
To resolve above issue, I would suggest changing the order of equations correctly.
Hope this helps!
댓글 수: 3
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!