我对 Matlab 和一般编程还很陌生,这个错误消息让我失望了。简化代码如下:
Lpi = .05;
Dpi = .01;
LpD = [.1, 06];
LpI = [.9, 14];
DpR = [.4, 06];
DpI = [.6, 08];
IpH = [01, 30];
syms H(t) L(t) D(t) R(t) I(t)
HtL =@(t) H(t) * (Lpi*L(t) + Dpi*D(t));
LtD =@(t) LpD(1)*HtL(t-LpD(2));
LtI =@(t) LpI(1)*HtL(t-LpI(2));
DtR =@(t) DpR(1)*LtD(t-DpR(2));
DtI =@(t) DpI(1)*LtD(t-DpI(2));
ItH =@(t) IpH(1)*(LtI(t-IpH(2))+DtI(t-IpH(2)));
odea = diff(H, t) == ItH(t) - HtL(t);
odeb = diff(L, t) == HtL(t) - LtD(t) - LtI(t);
odec = diff(D, t) == LtD(t) - DtR(t) - DtI(t);
oded = diff(R, t) == DtR(t);
odee = diff(I, t) == LtI(t) + DtI(t) - ItH(t);
odes = [odea;odeb;odec;oded;odee];
S = dsolve(odes);
如果对目的或操作有任何疑问,我可以尝试在下面解释。
一旦声明了微分方程,我的理解是它们确实是微分方程,因为 Matlab 的工作区显示它们的形式为:
val(t) =
diff(H(t), t) == (24*H(t - 44)*(D(t - 44)/100 + L(t - 44)/20))/25 - H(t)*(D(t)/100 + L(t)/20)
(这是 odea 的情况,我不包括其余部分,因为它们相似但更长)
当我调用 dsolve 时会弹出问题,因为它显示以下错误:
Error using mupadengine/feval_internal (line 172)
Expecting an ODE in the specified variable.
Error in dsolve>mupadDsolve (line 328)
T = feval_internal(symengine,'symobj::dsolve',sys,x,options);
Error in dsolve (line 183)
sol = mupadDsolve(args, options);
Error in main (line 50)
S = dsolve(odes);
我对这个错误感到非常困惑,因为据我所知,函数 dsolve 的教科书用法(根据 MathWorks 的“求解微分方程系统”页面)。
预先感谢您的任何帮助。