Code covered by the BSD License  

Highlights from
Tutorial on solving DDEs with DDE23

  • exam1
  • exam1
  • exam2
  • exam2
  • exam3
  • exam3
  • exam4
  • exam4
  • exam5
  • exam5
  • exam6 This is a demonstration problem for CTMS/BD in
  • exam6 This is a demonstration problem for CTMS/BD in
  • exam7 An example from C. Marriott and C. DeLisle, Effects
  • exam7 An example from C. Marriott and C. DeLisle, Effects
  • exam8 This is the suitcase problem from Suherman, et al.,
  • exam8 This is the suitcase problem from Suherman, et al.,
  • exer1 Example 1 of K.W. Neves, Automatic integration
  • exer1 Example 1 of K.W. Neves, Automatic integration
  • exer2 Example of J.D. Farmer, Chaotic Attractors of an
  • exer2 Example of J.D. Farmer, Chaotic Attractors of an
  • exer3 Wheldon's model of chronic granuloctic leukemia
  • exer3 Wheldon's model of chronic granuloctic leukemia
  • exer5
  • exer5
  • exer6 Sample problem of ARCHI manual. The absolute error
  • exer6 Sample problem of ARCHI manual. The absolute error
  • exer7 Marchuk immunology model of E. Hairer, S.P. Norsett, and
  • exer7 Marchuk immunology model of E. Hairer, S.P. Norsett, and
  • prob1 This system of ODE's is taken from 'An Introduction to Nuermcial Methods
  • prob1 This system of ODE's is taken from 'An Introduction to Nuermcial Methods
  • prob2 This problem considers a cardiovascular model, which can be found in
  • prob2 This problem considers a cardiovascular model, which can be found in
  • prob2b This problem considers a cardiovascular model, which can be found in
  • prob2b This problem considers a cardiovascular model, which can be found in
  • prob3 This problem is epidemic model due to Cooke, more information can be
  • prob3 This problem is epidemic model due to Cooke, more information can be
  • prob4 This problem is an epidemic model due to Cooke et alia, more information
  • prob4 This problem is an epidemic model due to Cooke et alia, more information
  • prob5 This problem population growth model due to Cooke et alia, more information
  • prob5 This problem population growth model due to Cooke et alia, more information
  • View all files

Tutorial on solving DDEs with DDE23

by

 

22 Aug 2003 (Updated )

Solving delay differential equations with DDE23. Tutorial + Examples.

exam7
function sol = exam7
% An example from C. Marriott and C. DeLisle, Effects 
% of discontinuities in the behavior of a delay 
% differential equation, Physica D, 36 (1989), pp. 198-206.

% Copyright 2002, The MathWorks, Inc.

% The parameter state = +1 if ylag >= -0.427, -1 otherwise.  
% With this definition of history, state is initially +1.
state = +1;

opts = ddeset('Events',@exam7e);
sol = dde23(@exam7f,12,0.6,[0, 120],opts,state);
while sol.x(end) < 120
   fprintf('Restart at %5.1f.\n',sol.x(end));
   state = - state;
   sol = dde23(@exam7f,12,sol,[sol.x(end), 120],opts,state);
end
figure
plot(sol.x,sol.y);
title('Marriott-DeLisle Controller Problem')
xlabel('Restart each time y(t - 12) = -0.427.');

%-----------------------------------------------------------------------

function yp = exam7f(t,y,Z,state)
%EXAM7F  The derivative function for the Example 7 of the DDE Tutorial.
xb = -0.427;
a = 0.16;
epsilon = 0.02;
u = 0.5;
tau = 1;
Delta = Z - xb;
yp = (-y + pi*(a + epsilon*state - u*sin(Delta)^2)) / tau;

%-----------------------------------------------------------------------

function [value,isterminal,direction] = exam7e(t,y,Z,state)
%EXAM7E  The event function for the Example 7 of the DDE Tutorial.
xb = -0.427;
value = Z - xb;
isterminal = 1;
direction = 0;

Contact us