how can i stay 7t longer in my code
1 次查看(过去 30 天)
显示 更早的评论
[t,y]=ode45(@seirl,[0,300],[1,0,0.0014,0,0])
plot(t,y)
legend('S','E','I','R','l')
a=0.015;
b=0.6;
c=0.7;
e=0.2;
dydt=zeros(4,1);
dydt(1)=-a*y(1)*y(2);
dydt(2)=a*y(1)*y(2)-b*y(2)
dydt(3)=b*y(2)-c*y(3)
dydt(4)=c*y(3)
end
ive wrote those code to make SEIR model. But at the code I wrote, there are no incubation time,,, I want to make delay for 7t when moving dydt(2) to dydt(3) (when code goes dydt(2) to dydt(3), stay 7t to move on.) please help me :(
0 个评论
回答(1 个)
Steven Lord
2020-6-28
If your equations depend not just on the value of the solution at the current time but also the value of the solution at a previous time, you don't have a system of ordinary differential equations. Instead use a delay differential equation solver like dde23 or ddesd.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!