问题遇到的现象和发生背景
使用MATLAB求解微分方程组时报错
问题相关代码
clear,clc
syms S(t) E(t) I(t) A(t) Q(t) R(t);
%od
ode1=diff(S,t)==(-1)*9.77174671*(I+0.5*A+0.5*E)*(I+0.5*A+0.5*E)/0.776;
ode2=diff(E,t)==9.77174671*(I+0.5*A+0.5*E)*(I+0.5*A)/0.776-4.7*E;
ode3=diff(I,t)==9.77174671*(I+0.5*A+0.5*E)*S-25.3458333*I;
ode4=diff(A,t)==9.77174671*(I+0.5*A+0.5*E)*S-0.5*25.3458333*A;
ode5=diff(Q,t)==0.8458333*(I+A)-24.5*Q;
ode6=diff(R,t)==24.5*(I+A)+23.7*Q;
ode=[ode1,ode2,ode3,ode4,ode5,ode6];
%cond
cond1=S(0)==24870895;
cond2=E(0)==0;
cond3=I(0)==56;
cond4=A(0)==18;
cond5=Q(0)==0;
cond6=R(0)==0;
cond=[cond1,cond2,cond3,cond4,cond5,cond6];
[Ss(t),Es(t),Is(t),As(t),Qs(t),Rs(t)]=dsolve(ode,cond);
报错结果
警告: Explicit solution could not be found.
In dsolve (line 201)https://pic1.zhimg.com/80/v2-f445b6d5437bd26918b2a149002ff88d_720w.png
In moxing2 (line 19)
错误使用 sym/subsindex (line 766)
Invalid indexing or function definition. When defining a function, ensure that the arguments are symbolic variables and the body of the function is a SYM expression.
When indexing, the input must be numeric, logical, or ':'.
出错 moxing2 (line 19)
[Ss(t),Es(t),Is(t),As(t),Qs(t),Rs(t)]=dsolve(ode,cond);
我想要达到的结果
不再报错
谢谢大家!