필터 지우기
필터 지우기

Code keeps on running. Neither shows error nor gets executed.

조회 수: 1 (최근 30일)
Saregama
Saregama 2020년 9월 24일
댓글: Saregama 2020년 10월 1일
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 ("entering");
mumax=1.09;
kdmax=0.69;
kglc=1.0;
kgln=0.3;
kdlac=0.01;
kdamm=0.06;
kdgln=0.02;
a0=2.57*(10^(-8));
b=0.35*(10^(-8));
yxvglc=1.09*(10^(8));
yxvgln=3.8*(10^(8));
ylacglc=1.8;
yammgln=0.85;
mglc=0.17;
kmglc=19.0;
kmu=0.02;
glcin=25;
glnin=4;
F1= glcin;
F2= glnin;
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");
L= -qmab*xv*V;
tf=10;
J = int(L,t,0,tf);
display(J);
display ("end; Thank You");

채택된 답변

Raunak Gupta
Raunak Gupta 2020년 9월 30일
Hi,
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
Raunak Gupta
Raunak Gupta 2020년 10월 1일
Hi,
If the equation are interdependent then you may need to simply them a bit to solve. Without simplying the solution cannot be calculated with usual differential equation method. The main issue is the dependence of t is not defined for gln(t) and glc(t), which will hinder giving the exact solution. I am pretty sure if you can simplify the equations, a solution is possible.
Saregama
Saregama 2020년 10월 1일
Okay will work on simplification. Thank you.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by