how to modify code for the system of delay differential equation with one or more delays
Show older comments
I am trying to write a code for the system of delay differential equation with one or multiple delays
%% Find solution
sol = dde23(@(t,y,Z) g(t,y,Z,par), tau, phi, tspan);
%% Select data points based on user input
if dist == 1
t_ae = linspace(tspan(1), tspan(1) + ((tspan(2) - tspan(1))*t_r), N);
else
t_ae = tspan(1) + ((tspan(2) - tspan(1))*t_r) * rand(1, N);
end
%% Find current and delayed state terms
% x_t = deval(sol, t_ae);
for i = 1:size(sol.y,1)
x_t(i,:)=deval(sol,t_ae,i);
x_tn(i,:) = x_t(i,:) + n_a * randn(size(x_t(i,:)));
end
for j = 1:size(x_t, 1)
% x_d = zeros(length(tau), length(t_ae));
for k = 1:size(tau,2)
t_d = t_ae - tau(k);
for i = 1:length(t_d)
if t_d(i) <= 0
x_d(k, i) = phi(t_d(i));
else
x_d(k, i) = interp1(t_ae, x_tn, t_d(i), 'linear');
end
end
end
end
this code is working well for the equation of delay differential equation with one or more delays but now i am trying to modify this to handle the system of DDEs with one or more delays. where i am donig mistake in this code
Accepted Answer
More Answers (0)
Categories
Find more on Numerical Integration and Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!