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 :(

回答(1 个)

Steven Lord
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.

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

标签

产品


版本

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by