How to Extract Delayed State Terms in a Model with Distributed Delay?

I'm working on a model with distributed delays, and I'm using the ddesd function to solve the delay differential equations. My setup involves a distributed delay, defined by:
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
In the case of discrete delays, we can easily extract the delayed state terms using the deval or interp1 commands. However, I'm unsure how to proceed with extracting or examining the delayed state terms for distributed delay case.

 Accepted Answer

So in the distributed case you want to extract
y2_delayed(t) = integral_{tau = t-1.5]^{tau = t-0.5} y2(tau) dtau
thus the term yl1 in ddefunc ?
I plotted it as "Lag term" below.
tau = 1;
gamma = 0.5;
lags = [tau-gamma;tau+gamma];
tspan = [0 600];
sol = dde23(@ddefunc,lags,[0.2; 0.08; 0.08*2*gamma],tspan,ddeset('RelTol',1e-6,'AbsTol',1e-6));
figure(1)
p = plot(sol.x,sol.y(1:2,:));
set(p,{'LineWidth'},{2;2})
title('y(t)')
xlabel('Time(days)'), ylabel('populations')
legend('x','y')
figure(2)
p = plot(sol.x,sol.y(3,:));
set(p,{'LineWidth'},{2})
title('Lag(t)')
xlabel('Time(days)'), ylabel('Lag term')
legend('Lag')
function yp = ddefunc(~,y,Z)
a=0.1;
b=0.05;
c=0.08;
d=0.02;
yp = [a*y(1)-b*y(1)*y(3);
c*y(1)*y(2)-d*y(2);
Z(2,1)-Z(2,2)];
end

More Answers (1)

What exactly do you want to extract ? y2, evaluated at (t-lags) ?
And you know that your equation can be solved using dde23 because you can treat
integral_{tau = t-1.5]^{tau = t-0.5} y2(tau) dtau
in the same way as I suggested here:
?
In this case, you get an equation with discrete delays of length 1.5 and 0.5.
Hint:
d/dt (integral_{tau = t-1.5]^{tau = t-0.5} y2(tau) dtau) = y2(t-0.5) - y2(t-1.5)

2 Comments

Thank you for your response. My target is to extract delayed state like for discrete delay we extract y(t-tau).
t_eval = 600;
y_delayed_deval = deval(sol, t_eval - lags); % y(t-tau)
or
y_delayed_interp1 = interp1(sol.x, sol.y(2,:), t_eval - lags);
now for distributed delay I am not sure how we can extract this
yes I want to extract yl1 in ddefunc

Sign in to comment.

Categories

Find more on Numerical Integration and Differential Equations in Help Center and File Exchange

Asked:

on 22 Aug 2024

Edited:

on 22 Aug 2024

Community Treasure Hunt

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

Start Hunting!