How to solve a system of distributed delay equations?

조회 수: 9 (최근 30일)
Fares
Fares 2023년 6월 29일
댓글: José 2024년 11월 6일
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
  댓글 수: 18
Torsten
Torsten 2024년 11월 5일
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
José
José 2024년 11월 6일
Thanks a lot Torsten.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Digital Filter Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by