How to make this ode45 work?
显示 更早的评论
Here are the command i have input:
syms S I R beta gamma B mi
eqns = [B-beta*S*I-gamma*I-mi*I==0, gamma*I-mi*R==0];
Sol=solve(eqns, [S I R]);
y0=[1000 20 0];
tspan=[0 100];
beta = 0.00004;
gamma = 0.009;
[t,y] = ode45(@(t,y) sir_eq(t,y,beta,gamma),tspan,y0);
I am met with:
Error in @(t,y)sir_eq(t,y,beta,gamma)
Error in odearguments (line 90)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Could anyone explain what exactly the error is/what i need to do? Thanks
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!