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

1 visualización (últimos 30 días)
Saregama
Saregama el 24 de Sept. de 2020
Comentada: Saregama el 1 de Oct. de 2020
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");

Respuesta aceptada

Raunak Gupta
Raunak Gupta el 30 de Sept. de 2020
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 comentarios
Raunak Gupta
Raunak Gupta el 1 de Oct. de 2020
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 el 1 de Oct. de 2020
Okay will work on simplification. Thank you.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by