warning: Solving was not successful. The iterative integration loop exited at time t = 0.000000 before the endpoint at tend = 0.001000 was reached

조회 수: 6 (최근 30일)
Hi,I'm trying to solve a big system of ODE here is my code with ODE45
k1 k2 k3...
F=@(t,n)([k1*n(2)*n(42)+k15*n(5)*n(9)+k16*n(5)*n(26)+k25*n(4)*n(26)...
.+k29*n(4)*n(9)+k33*n(4)*n(11)+k39*n(7)*n(26)+k40*n(7)*n(27)...
.+k43*n(7)*n(9)+k44*n(7)*n(12)+k48*n(9)*n(9)+k59*n(11)*n(42)...
.+k72*n(2)*n(24)+k104*n(3)*n(5)+k105*n(3)*n(8)+k106*n(3)*n(25)...
.+k117*n(18)*n(2)+k119*n(3)*n(43)+k122*n(11)*n(43)+k124*n(13)*n(43)...
.+k130*n(22)*n(43)-k4*n(1)*n(37)-k8*n(1)*n(15)-k9*n(1)*n(26)...
.-k10*n(1)*n(24)-k11*n(1)*n(20)-k12*n(1)*n(35)-k13*n(1)*n(22)...
.-k61*n(2)*n(1)-k64*n(1)*n(13)-k65*n(1)*n(4)-k66*n(1)*n(9)...
.-k67*n(1)*n(5)-k68*n(1)*n(1)-k69*n(1)*n(7)-k73*n(1)*n(27)...
.-k74*n(1)*n(11)-k75*n(1)*n(23)-k76*n(1)*n(21)-k77*n(1)*n(19)...
.-k118*n(1)*n(43)-k132*n(1)*n(42)-k136*n(1)*n(3)-k137*n(1)*n(12)...
.-k138*n(1)*n(14)-k139*n(1)*n(6)-2*k164*n(7)*n(1)*n(1)...
.+k164*n(7)*n(1)^(2)-k163*n(1)*n(15)*n(4)+k163*n(1)*n(15)*n(4)...
.-k165*n(1)*n(32)*n(4)+k165*n(1)*n(32)*n(4);%Chemin réactionnel C
-k1*n(2)*n(42)-k5*n(2)*n(15)-k6*n(2)*n(30)-k7*n(2)*n(36)...
.-k61*n(2)*n(1)-k62*n(2)*n(7)-k63*n(2)*n(4)-k72*n(2)*n(24)...
.-k117*n(18)*n(2)+k45*n(7)*n(11)+k73*n(1)*n(27)...
.+k74*n(1)*n(11)+k75*n(1)*n(23)+k76*n(1)*n(21)...
.+k77*n(1)*n(19)+k118*n(1)*n(43)+k122*n(11)*n(43);%chemin reactionnel C+
k32*n(4)*n(12)+k132*n(1)*n(42)-k14*n(3)*n(24)-k104*n(3)*n(5)...
.-k105*n(3)*n(8)-k106*n(3)*n(25)-k119*n(3)*n(43)...
.-k136*n(1)*n(3)-k140*n(3)*n(4)-k141*n(3)*n(15)-k142*n(3)*n(7); %Chemin réactionnel C-
k2*n(5)*n(42)+k8*n(1)*n(15)+k10*n(1)*n(24)+k13*n(1)*n(22)...
.+k14*n(3)*n(24)+k35*n(7)*n(15)+k36*n(7)*n(19)...
.+k37*n(7)*n(24)+k38*n(7)*n(32)+k52*n(15)*n(24)...
.+k53*n(15)*n(20)+k55*n(15)*n(22)+k56*n(15)*n(26)...
.+k78*n(5)*n(9)+k79*n(5)*n(22)+k80*n(5)*n(30)...
.+k81*n(5)*n(15)+k84*n(6)*n(15)+k85*n(6)*n(26)...
.+k104*n(3)*n(5)+2*k107*n(5)*n(6)+k108*n(5)*n(18)...
.+k109*n(6)*n(8)+k120*n(6)*n(43)+2*k126*n(15)*n(43)...
.+k128*n(19)*n(43)+k130*n(22)*n(43)+k131*n(24)*n(43)...
.+k162*n(42)*n(4)*n(15)-k19*n(4)*n(24)-k20*n(4)*n(32)...
.-k21*n(4)*n(30)-k22*n(4)*n(30)-k23*n(4)*n(20)...
.-k24*n(4)*n(36)-k25*n(4)*n(26)-k26*n(4)*n(26)...
.-k27*n(4)*n(13)-k28*n(4)*n(35)-k29*n(4)*n(9)...
.-k30*n(4)*n(21)-k31*n(4)*n(14)-k32*n(4)*n(12)...
.-k33*n(4)*n(11)-k63*n(2)*n(4)-k65*n(1)*n(4)...
.-2*k70*n(4)*n(4)-k82*n(4)*n(21)-k83*n(4)*n(23)...
.-k133*n(4)*n(42)-k140*n(3)*n(4)-k143*n(4)*n(6)...
.-k144*n(4)*n(12)-k161*n(42)*n(4)*n(15)...
.-k162*n(42)*n(4)*n(15)-k163*n(1)*n(15)*n(4)-k165*n(1)*n(32)*n(4);%Chemin réactionnel O
k5*n(2)*n(15)+k34*n(8)*n(15)+k82*n(4)*n(21)...
.+k83*n(4)*n(23)+k128*n(19)*n(43)-k19*n(4)*n(24)...
.-k20*n(4)*n(32)-k21*n(4)*n(30)-k22*n(4)*n(30)...
.-k23*n(4)*n(20)-k24*n(4)*n(36)-k25*n(4)*n(26)...
.-k26*n(4)*n(26)-k27*n(4)*n(13)-k28*n(4)*n(35)...
.-k29*n(4)*n(9)-k30*n(4)*n(21)-k31*n(4)*n(14)...
.-k32*n(4)*n(12)-k33*n(4)*n(11)-k63*n(2)*n(4)...
.-k65*n(1)*n(4)-2*k70*n(4)*n(4)-k82*n(4)*n(21)...
.-k83*n(4)*n(23)-k133*n(4)*n(42)-k140*n(3)*n(4)...
.-k143*n(4)*n(6)-k144*n(4)*n(12)-k161*n(42)*n(4)*n(15)...
.-k162*n(42)*n(4)*n(15)-k163*n(1)*n(15)*n(4)-k165*n(1)*n(32)*n(4);%Chemin réactionnel O+
k133*n(4)*n(42)+k161*n(42)*n(4)*n(15)-k84*n(6)*n(15)...
.-k85*n(6)*n(26)-k107*n(5)*n(6)-k109*n(6)*n(8)-k120*n(6)*n(43)...
.-k139*n(1)*n(6)-k143*n(4)*n(6)-k145*n(6)*n(24)...
.-k146*n(6)*n(22)-k147*n(6)*n(7);% %Chemin réactionnel O-
k3*n(8)*n(42)+k9*n(1)*n(26)+k11*n(1)*n(20)...
.+k18*n(5)*n(20)+k19*n(4)*n(24)+k23*n(4)*n(20)...
.+k26*n(4)*n(26)+k30*n(4)*n(21)+2*k60*n(21)*n(42)...
.+k86*n(8)*n(15)+k87*n(8)*n(9)+k88*n(8)*n(22)...
.+k89*n(8)*n(26)+k90*n(8)*n(24)+k105*n(3)*n(8)...
.+k109*n(6)*n(8)+k110*n(8)*n(18)+k111*n(8)*n(12)...
.+k112*n(8)*n(28)+k113*n(8)*n(14)+2*k129*n(20)*n(43)...
.+k131*n(24)*n(43)+2*k159*n(20)*n(42)-k35*n(7)*n(15)...
.-k36*n(7)*n(19)-k37*n(7)*n(24)-k38*n(7)*n(32)...
.-k39*n(7)*n(26)-k40*n(7)*n(27)-k41*n(7)*n(13)...
.-k42*n(7)*n(14)-k43*n(7)*n(9)-k44*n(7)*n(12)...
.-k45*n(7)*n(11)-k46*n(7)*n(35)-k62*n(2)*n(7)...
.-k69*n(1)*n(7)-k71*n(8)*n(7)-k91*n(7)*n(21)...
.-k142*n(3)*n(7)-k147*n(6)*n(7)-k164*n(7)*n(1)*n(1);%Chemin réactionnel N
k91*n(7)*n(21)-k3*n(8)*n(42)-k34*n(8)*n(15)...
.-k71*n(8)*n(7)-k86*n(8)*n(15)-k87*n(8)*n(9)...
.-k88*n(8)*n(22)-k89*n(8)*n(26)-k90*n(8)*n(24)...
.-k105*n(3)*n(8)-k109*n(6)*n(8)-k110*n(8)*n(18)...
.-k111*n(8)*n(12)-k112*n(8)*n(28)-k113*n(8)*n(14);%Chemin réactionnel N+
k9*n(1)*n(26)+k12*n(1)*n(35)+k13*n(1)*n(22)...
.+k27*n(4)*n(13)+k41*n(7)*n(13)+k68*n(1)*n(1)...
.+k74*n(1)*n(11)+k94*n(11)*n(24)+k111*n(8)*n(12)...
.+k115*n(12)*n(25)+k121*n(9)*n(43)+k123*n(12)*n(43)...
.+k124*n(13)*n(43)+k136*n(1)*n(3)+k153*n(10)*n(42)...
.+k154*n(10)^(2)+k155*n(10)*n(1)-k15*n(5)*n(9)...
.-k29*n(4)*n(9)-k43*n(7)*n(9)-k47*n(9)*n(15)...
.-2*k48*n(9)*n(9)-k49*n(9)*n(19)-k66*n(1)*n(9)...
.-k78*n(5)*n(9)-k87*n(8)*n(9)-k92*n(9)*n(23)...
.-k93*n(9)*n(27)-k121*n(9)*n(43)-k134*n(9)*n(42)...
.-k148*n(9)*n(12)-k150*n(9)*n(42);%Chemin réactionnel C2
k150*n(9)*n(42)-k153*n(10)*n(42)-k154*n(10)^(2)-k155*n(10)*n(1);%C2(d)
k61*n(2)*n(1)+k78*n(5)*n(9)+k87*n(8)*n(9)...
.+k92*n(9)*n(23)+k93*n(9)*n(27)-k33*n(4)*n(11)...
.-k45*n(7)*n(11)-k50*n(11)*n(15)-k59*n(11)*n(42)...
.-k74*n(1)*n(11)-k94*n(11)*n(24)-k122*n(11)*n(43);%Chemin réactionnel C2+
-k32*n(4)*n(12)-k44*n(7)*n(12)-k111*n(8)*n(12)...
.-k115*n(12)*n(25)-k123*n(12)*n(43)-k137*n(1)*n(12)...
.-k144*n(4)*n(12)-k148*n(9)*n(12)-k149*n(12)*n(13)...
.+k31*n(4)*n(14)+k42*n(7)*n(14)+k134*n(9)*n(42);%Chemin réactionnel C2-
k48*n(9)*n(9)+k66*n(1)*n(9)+k113*n(8)*n(14)...
.+k114*n(14)*n(25)+k125*n(14)*n(43)...
.+k137*n(1)*n(12)-k27*n(4)*n(13)-k41*n(7)*n(13)...
.-k64*n(1)*n(13)-k124*n(13)*n(43)...
.-k135*n(13)*n(42)-k149*n(12)*n(13);%Chemin réactionnel C3
k135*n(13)*n(42)-k31*n(4)*n(14)...
.-k42*n(7)*n(14)-k113*n(8)*n(14)...
.-k114*n(14)*n(25)-k125*n(14)*n(43)-k138*n(1)*n(14);%Chemin réactionnel C3-
k17*n(5)*n(32)+k19*n(4)*n(24)+k20*n(4)*n(32)...
.+k21*n(4)*n(30)+k57*n(24)*n(24)+k70*n(4)*n(4)...
.+k77*n(1)*n(19)+k97*n(19)*n(32)+k98*n(19)*n(24)...
.+k108*n(5)*n(18)+k110*n(8)*n(18)+k116*n(18)*n(25)...
.+k117*n(18)*n(2)+k127*n(18)*n(43)+k143*n(4)*n(6)...
.+2*k156*n(18)*n(15)+2*k157*n(18)*n(16)...
.+2*k158*n(18)*n(17)+k161*n(42)*n(4)*n(15)...
.-k5*n(2)*n(15)-k8*n(1)*n(15)-k34*n(8)*n(15)...
.-k35*n(7)*n(15)-k47*n(9)*n(15)-k50*n(11)*n(15)...
.-k51*n(15)*n(37)-k52*n(15)*n(24)-k53*n(15)*n(20)...
.-k54*n(15)*n(27)-k55*n(15)*n(22)-k56*n(15)*n(26)...
.-k81*n(5)*n(15)-k84*n(6)*n(15)-k86*n(8)*n(15)...
.-k95*n(15)*n(21)-k96*n(15)*n(23)-k126*n(15)*n(43)...
.-k141*n(3)*n(15)-k151*n(15)*n(42)-k152*n(15)*n(42)...
.-k156*n(18)*n(15)-k161*n(42)*n(4)*n(15)...
.-k162*n(42)*n(4)*n(15)-k163*n(1)*n(15)*n(4);%Chemin réactionnel O2
k151*n(42)*n(15)-k157*n(16)*n(18);%Chemin réactionnel O2(a)
k152*n(42)*n(15)-k158*n(17)*n(18);%Chemin réactionnel O2(b)
k84*n(6)*n(15)+k162*n(42)*n(4)*n(15)...
.-k108*n(5)*n(18)-k110*n(8)*n(18)...
.-k116*n(18)*n(25)-k117*n(18)*n(2)-k127*n(18)*n(43)...
.-k156*n(18)*n(15)-k157*n(18)*n(16)-k158*n(18)*n(17);%Chemin réactionnel O2-
k81*n(5)*n(15)+k86*n(8)*n(15)+k95*n(15)*n(21)...
.+k96*n(15)*n(23)-k36*n(7)*n(19)-k49*n(9)*n(19)-k77*n(1)*n(19)...
.-k97*n(19)*n(32)-k98*n(19)*n(24)-k128*n(19)*n(43);%Chemin réactionnel O2+
k21*n(4)*n(30)+k37*n(7)*n(24)+k39*n(7)*n(26)...
.+k57*n(24)*n(24)+k76*n(1)*n(21)+k82*n(4)*n(21)...
.+k91*n(7)*n(21)+k95*n(15)*n(21)+k99*n(21)*n(26)...
.+k100*n(21)*n(22)-k11*n(1)*n(20)-k18*n(5)*n(20)...
.-k23*n(4)*n(20)-k53*n(15)*n(20)...
.-k129*n(20)*n(43)-k159*n(20)*n(42)-k160*n(20)*n(42);%Chemin réactionnel N2
k40*n(7)*n(27)+k71*n(8)*n(7)+k160*n(20)*n(42)...
.-k30*n(4)*n(21)-k60*n(21)*n(42)-k76*n(1)*n(21)...
.-k82*n(4)*n(21)-k91*n(7)*n(21)...
.-k95*n(15)*n(21)-k99*n(21)*n(26)-k100*n(21)*n(22);%Chemin réactionnel N2+
k4*n(1)*n(37)+k5*n(2)*n(15)+k8*n(1)*n(15)...
.+k24*n(4)*n(36)+k26*n(4)*n(26)+k27*n(4)*n(13)...
.+k28*n(4)*n(35)+k29*n(4)*n(9)+k31*n(4)*n(14)...
.+k32*n(4)*n(12)+2*k47*n(9)*n(15)+k49*n(9)*n(19)...
.+k50*n(11)*n(15)+k54*n(15)*n(27)+k58*n(24)*n(37)...
.+k65*n(1)*n(4)+k75*n(1)*n(23)+k83*n(4)*n(23)...
.+k92*n(9)*n(23)+k96*n(15)*n(23)+k102*n(24)*n(23)...
.+k139*n(1)*n(6)+k140*n(3)*n(4)-k13*n(1)*n(22)...
.-k55*n(15)*n(22)-k79*n(5)*n(22)-k88*n(8)*n(22)...
.-k100*n(21)*n(22)-k101*n(22)*n(27)...
.-k130*n(22)*n(43)-k146*n(6)*n(22);%Chemin réactionnel CO
k7*n(2)*n(36)+k15*n(5)*n(9)+k33*n(4)*n(11)...
.+k49*n(9)*n(19)+k50*n(11)*n(15)+k63*n(2)*n(4)...
.+k67*n(1)*n(5)+k79*n(5)*n(22)+k88*n(8)*n(22)...
.+k100*n(21)*n(22)+k101*n(22)*n(27)-k75*n(1)*n(23)...
.-k83*n(4)*n(23)-k92*n(9)*n(23)...
.-k96*n(15)*n(23)-k102*n(24)*n(23);%Chemin réactionnel CO+
k20*n(4)*n(32)+k22*2*n(4)*n(30)+k23*n(4)*n(20)...
.+k24*n(4)*n(36)+k25*n(4)*n(26)+k34*n(8)*n(15)...
.+k35*n(7)*n(15)+k51*n(15)*n(37)+k106*n(3)*n(25)...
.+k114*n(14)*n(25)+k115*n(12)*n(25)+k116*n(18)*n(25)...
.+k147*n(6)*n(7)-k10*n(1)*n(24)-k14*n(3)*n(24)-k19*n(4)*n(24)...
.-k37*n(7)*n(24)-k52*n(15)*n(24)-k57*2*n(24)*n(24)...
.-k58*n(24)*n(37)-k72*n(2)*n(24)-k90*n(8)*n(24)...
.-k94*n(11)*n(24)-k98*n(19)*n(24)-k102*n(24)*n(23)...
.-k103*n(24)*n(27)-k131*n(24)*n(43)-k145*n(6)*n(24);%Chemin réactionnel NO
k6*n(2)*n(30)+k16*n(5)*n(26)+k17*n(5)*n(32)...
.+k18*n(5)*n(20)+k30*n(4)*n(21)+k36*n(7)*n(19)...
.+k54*n(15)*n(27)+k72*n(2)*n(24)+k90*n(8)*n(24)...
.+k94*n(11)*n(24)+k98*n(19)*n(24)+k102*n(24)*n(23)...
.+k103*n(24)*n(27)-k106*n(3)*n(25)-k114*n(14)*n(25)...
.-k115*n(12)*n(25)-k116*n(18)*n(25);%Chemin réactionnel NO+
k4*n(1)*n(37)+k6*n(2)*n(30)+k7*n(2)*n(36)...
.+k10*n(1)*n(24)+k11*n(1)*n(20)+k12*n(1)*n(35)...
.+k28*n(4)*n(35)+k41*n(7)*n(13)+k42*n(7)*n(14)...
.+k43*n(7)*n(9)+k45*n(7)*n(11)+k46*2*n(7)*n(35)...
.+k69*n(1)*n(7)+k73*n(1)*n(27)+k93*n(9)*n(27)...
.+k101*n(22)*n(27)+k103*n(24)*n(27)...
.+k112*n(8)*n(28)+k142*n(3)*n(7)...
.+k164*n(7)*n(1)*n(1)-k9*n(1)*n(26)-k16*n(5)*n(26)...
.-k25*n(4)*n(26)-k26*n(4)*n(26)-k39*n(7)*n(26)...
.-k56*n(15)*n(26)-k85*n(6)*n(26)...
.-k89*n(8)*n(26)-k99*n(21)*n(26);%Chemin réactionnel CN
k62*n(2)*n(7)+k89*n(8)*n(26)+k99*n(21)*n(26)...
.-k40*n(7)*n(27)-k54*n(15)*n(27)...
.-k73*n(1)*n(27)-k93*n(9)*n(27)...
.-k101*n(22)*n(27)-k103*n(24)*n(27);%Chemin réactionnel CN+
k14*n(3)*n(24)+k44*n(7)*n(12)+k85*n(6)*n(26)-k112*n(8)*n(28);%CN-
k163*n(1)*n(15)*n(4);%Chemin réactionnel O3
k38*n(7)*n(32)+k53*n(15)*n(20)+k58*n(24)*n(37)...
.-k6*n(2)*n(30)-k21*n(4)*n(30)...
.-k22*n(4)*n(30)-k80*n(5)*n(30);%Chemin réactionnel N2O
k80*n(5)*n(30);%Chemin réactionnel N2O+
k52*n(15)*n(24)+k145*n(6)*n(24)-k17*n(5)*n(32)...
.-k20*n(4)*n(32)-k38*n(7)*n(32)...
.-k97*n(19)*n(32)-k165*n(1)*n(32)*n(4);%Chemin réactionnel NO2
k97*n(19)*n(32);%Chemin réactionnel NO2+
k51*n(15)*n(37)+k55*n(15)*n(22)...
.+k141*n(3)*n(15)+k146*n(6)*n(22);%Chemin réactionnel CO2
-k12*n(1)*n(35)-k28*n(4)*n(35)-k46*n(7)*n(35);%Chemin réactionnel C2N
-k7*n(2)*n(36)-k24*n(4)*n(36);%Chemin réactionnel CNO
-k4*n(1)*n(37)-k51*n(15)*n(37)...
.-k58*n(24)*n(37)+k56*n(15)*n(26);%Chemin réactionnel OCN
k165*n(1)*n(32)*n(4);%Chemin réactionnel NO3
k144*n(4)*n(12);%Chemin réactionnel C2O
k64*n(1)*n(13)+k138*n(1)*n(14)+k148*n(9)*n(12);%Chemin réactionnel C4
k149*n(12)*n(13);%Chemin réactionnel C5
k118*n(1)*n(43)+k119*n(3)*n(43)+k120*n(6)*n(43)...
.+k121*n(12)*n(43)+k123*n(12)*n(43)+k125*n(14)*n(43)...
.+k127*n(18)*n(43)+k136*n(1)*n(3)+k137*n(1)*n(12)...
.+k138*n(1)*n(14)+k139*n(1)*n(6)+k140*n(3)*n(4)...
.+k141*n(3)*n(15)+k142*n(3)*n(7)+k143*n(4)*n(6)...
.+k144*n(4)*n(12)+k145*n(6)*n(24)+k146*n(6)*n(22)...
.+k147*n(6)*n(7)+k148*n(9)*n(12)+k149*n(12)*n(13)...
.+k150*n(9)*n(42)+k151*n(15)*n(42)+k152*n(15)*n(42)...
.+k153*n(10)*n(42)+k156*n(18)*n(15)+k157*n(18)*n(16)...
.+k158*n(18)*n(17)+k159*n(20)*n(42)...
.+2*k160*n(20)*n(42)-k1*n(2)*n(42)-k2*n(5)*n(42)...
.-k3*n(8)*n(42)-k59*n(11)*n(42)-k60*n(21)*n(42)...
.-k132*n(1)*n(42)-k133*n(4)*n(42)-k134*n(9)*n(42)...
.-k135*n(13)*n(42)-k150*n(9)*n(42)-k151*n(15)*n(42)...
.-k152*n(15)*n(42)-k153*n(10)*n(42)-k159*n(20)*n(42)...
.-k160*n(20)*n(42)-k161*n(42)*n(4)*n(15)...
.-k162*n(42)*n(4)*n(15);%Chemin réactionnel e-
-k118*n(1)*n(43)-k119*n(3)*n(43)-k120*n(6)*n(43)...
.-k121*n(9)*n(43)-k122*n(11)*n(43)-k123*n(12)*n(43)...
.-k124*n(13)*n(43)-k125*n(14)*n(43)-k126*n(15)*n(43)...
.-k127*n(18)*n(43)-k128*n(19)*n(43)-k129*n(20)*n(43)...
.-k130*n(22)*n(43)-k131*n(24)*n(43)+k1*n(2)*n(42)...
.+k2*n(5)*n(42)+k3*n(8)*n(42)+k61*n(2)*n(1)...
.+k62*n(2)*n(7)+k63*n(2)*n(4)+k64*n(1)*n(13)...
.+k65*n(1)*n(4)+k66*n(1)*n(9)+k67*n(1)*n(5)...
.+k68*n(1)*n(1)+k69*n(1)*n(7)+k70*n(4)*n(4)...
.+k71*n(8)*n(7)+k132*n(1)*n(42)+k133*n(4)*n(42)...
.+k134*n(9)*n(42)+k135*n(13)*n(42)])
OPTs = OPTs = odeset('reltol', 1e-3, 'abstol', 1e-5)
tic,[Time, SOL]=ode45(F,[0 1e-3],IC, OPTs);
toc
plot(Time,SOL)
I got these errors
warning: Solving was not successful. The iterative integration loop exited
at time t = 0.000000 before the endpoint at tend = 0.001000 was reached. Thi
s may happen if the stepsize becomes too small. Try to reduce the value of '
InitialStep' and/or 'MaxStep' with the command 'odeset'.
warning: called from
integrate_adaptive at line 318 column 7
ode45 at line 241 column 12
imene14echkabilov at line 246 column 16

채택된 답변

Jan
Jan 2021년 5월 28일
편집: Jan 2021년 5월 28일
The first guess in chemical systems is usually: The problem is stiff. Then you need a solver for stiff problems as ODE15S instead of the non-stiff ODE45.
By the way, the code does not run, because there are no ".+" and ".-" operators in Matlab.
The coe would be much easier to debug, if you do not squeeze a huge equation in a function handle, but if you write it to a function. I assume it the the result of some matrix equations. Then the matrix notation would be easier the debug and it even would run faster, most likely.
  댓글 수: 7
Steven Lord
Steven Lord 2021년 5월 28일
I second Jan's suggestion to create this as a function (either in a separate file or as a local function in the file where you call the ODE solver.) You can write this as an anonymous function but writing as a function will let you define variables with descriptive names that make the equations look closer to the actual chemical equations, extract subexpressions that are used repeatedly and so only evaluate them (and check that they are correct!) once, and more easily debug problems with the code. Think something like:
function dydt = myequations(t, y)
% Concentrations
O2conc = y(1);
CO2conv = y(2);
Nconv = y(3);
% now work with the oxygen, carbon dioxide, and nitrogen concentrations
% using the obviously named variables
end
Sure, you'll spend a couple extra seconds typing. [Tab completion may help mitigate that.] But if you choose your variable names well, you may not need to explain your code to anyone because it will be self documenting and that will save you time.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by