所以我有一个数值列表:
{0.905245, 0.892301, 0.878108, 0.862665, 0.845973, 0.828032,
0.808735, 0.787971, 0.76574, 0.742041, 0.716876, 0.690204, 0.661985,
0.632219, 0.600904, 0.568043, 0.533703, 0.497957, 0.460804, 0.422245,
0.38228, 0.341124, 0.299, 0.255908, 0.21185, 0.166824, 0.121233,
0.0754879, 0.0295888, -0.0164643, -0.0626715, -0.109033, -0.155548,
-0.202218, -0.249041, -0.296019, -0.34315, -0.390436, -0.437876,
-0.48547, -0.533218
}
和一组要求解的微分方程:
odes = {m'[t] == (0.05*mpp[t])/(0.95 + mpp[t]) - (0.69*(j)*(1 - pp[t]/(m[t] + mpp[t])))),mpp'[t] == (-0.05*mpp[t])/(0.95 + mpp[t]) + (0.69*(j)*(1 - (mpp[t]/(m[t] + mpp[t])))), mpp[0] == 0, m[0] == 1, e'[t] == (0.1*epp[t]/(0.95 + epp[t])) - 0.725*mpp[t]*(1 - (epp[t]/(e[t] + epp[t]))), epp'[t] == (-0.1*epp[t]/(0.95 + epp[t])) + 0.725*mpp[t]*(1 - (epp[t]/(e[t] + epp[t]))), e[0] == 1, epp[0] == 0}; solns = ParametricNDSolve[odes, {m, mpp, e, epp}, {t, 0, 10}, j]
我正在尝试使用列表中的值来改变参数j。有没有人这样做过?建议?
答案 0 :(得分:0)
首先我们将列表分配给变量
list = {0.905245, 0.892301, 0.878108, 0.862665, 0.845973, 0.828032,
0.808735, 0.787971, 0.76574, 0.742041, 0.716876, 0.690204, 0.661985,
0.632219, 0.600904, 0.568043, 0.533703, 0.497957, 0.460804,
0.422245, 0.38228, 0.341124, 0.299, 0.255908, 0.21185, 0.166824,
0.121233, 0.0754879,
0.0295888, -0.0164643, -0.0626715, -0.109033, -0.155548, -0.202218, \
-0.249041, -0.296019, -0.34315, -0.390436, -0.437876, -0.48547, \
-0.533218}
接下来,按照您的方式定义和求解方程式。然后我们提取解决方案列表
mList[t_] :=Table[m[j][t] /. solns, {j, list}];
mppList[t_] :=Table[mpp[j][t] /. solns, {j, list}];
eList[t_] :=Table[e[j][t] /. solns, {j, list}];
eppList[t_] :=Table[epp[j][t] /. solns, {j, list}];
要绘制范围m
中的解决方案包{t,0,1}
,请使用:
Plot[Evaluate[mlist[t]], {t, 0, 1}]