How to solve a system of distributed delay equations?
86 次查看(过去 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!
0 个评论
采纳的回答
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
18 个评论
Torsten
2024-11-5,19:45
lags1 = linspace(0,2r_1,number_of_delays_1);
lags2 = linspace(0,2r_2,number_of_delays_2);
lags3= @(t)[t-(cos(t)+2),t-pi/2,t-1];
lags = @(t,y)[t-lags1,t-lags2,lags3(t)];
sol = ddesd(@(t,y,Z)ddefunc(t,y,Z,lags1,number_of_delays_1,lags2,number_of_delays_2,lags3),lags,initialcondition,tspan);
function dydt = ddefunc(t,y,Z,lags1,number_of_delays_1,lags2,number_of_delays_2,lags3)
yl1 = trapz(lags1,Z(:,1:number_of_delays_1)); % First distributed delay
yl2 = trapz(lags2,Z(:,number_of_delays_1+1:number_of_delays_1+number_of_delays_2)); % Second distributed delay
ylag1 = Z(:,number_of_delays_1+number_of_delays_2+1); % ¿Evaluate the solution in the first delay of the list lags3?
ylag2 = Z(:,number_of_delays_1+number_of_delays_2+2); % ¿Evaluate the solution in the second delay of the list lags3?
dydt =-ylag1+yl1-ylag2+yl2;
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Digital Filter Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!