How to solve a system of distributed delay equations?

5 次查看(过去 30 天)
I have a code, which gives a solution of a system of discrete delay equations.
This is how I run it
lags=1;
tspan=[0 600];
sol=ddesd(@ddefunc,lags,[0.2; 0.08],tspan);
p=plot(sol.x,sol.y);
set(p,{'LineWidth'},{2;2})
title('y(t)')
xlabel('Time(days)'), ylabel('populations')
legend('x','y')
and this is the function
function yp = ddefunc(~,y,Z)
a=0.1;
b=0.05;
c=0.08;
d=0.02;
yl1=Z(:,1);
yp = [a*y(1)-b*y(1)*yl1(2);
c*y(1)*y(2)-d*y(2)];
end
Now, instead of one discrete delay value, I would like to consider a continuous delay values. That is, instead of , . Would it be possible to do this? Thanks!

采纳的回答

Torsten
Torsten 2023-6-29
编辑:Torsten 2023-6-29
As a start, you could define three delays, namely delay(1) = tau-gamma, delay(2) = tau and delay(3) = tau+gamma, and approximate the integral as "gamma * ( Z(:,1)/2 + Z(:,2) + Z(:,3)/2 )" (trapezoidal rule with three points).
In principle, you can approximate the integral arbitrarily close by choosing a sufficient number of delays:
tau = 1;
gamma = 0.5;
number_of_delays = 11; % should be odd
lags = linspace(tau-gamma,tau+gamma,number_of_delays);
tspan=[0 600];
sol=ddesd(@(t,y,Z)ddefunc(t,y,Z,lags),lags,[0.2; 0.08],tspan);
p=plot(sol.x,sol.y);
set(p,{'LineWidth'},{2;2})
title('y(t)')
xlabel('Time(days)'), ylabel('populations')
legend('x','y')
function yp = ddefunc(~,y,Z,lags)
a=0.1;
b=0.05;
c=0.08;
d=0.02;
yl1 = trapz(lags,Z(2,:));
yp = [a*y(1)-b*y(1)*yl1;
c*y(1)*y(2)-d*y(2)];
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Just for fun 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by