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.

exam3
function [sol1,sol2,sol3,sol4] = exam3
% Example 4.2 of H.J. Oberle and H.J. Pesch, Numerical 
% treatment of delay differential equations by Hermite 
% interpolation, Numer. Math., 37 (1981) 235-255.  This 
% problem is solved for four values of a parameter lambda.  
% Oberle and Pesch point out that the problem is numerically 
% more sensitive for the larger values of lambda, so they
% are solved with more stringent tolerances.

% Copyright 2004, The MathWorks, Inc.

  % Known parameter, visible in nested functions.
  lambda = 1.5;
  
  sol1 = dde23(@exam3f,1,@exam3h,[0, 20]);
  figure
  plot(sol1.x,sol1.y,'b')
  axis([0 20 -1 7]), drawnow, hold on
  
  lambda = 2.0;
  % After re-creating function handles, the new value 
  % of lambda will be used in nested functions.
  sol2 = dde23(@exam3f,1,@exam3h,[0, 20]);
  plot(sol2.x,sol2.y,'g'), drawnow
  
  lambda = 2.5;
  opts = ddeset('RelTol',1e-5,'AbsTol',1e-8);
  sol3 = dde23(@exam3f,1,@exam3h,[0, 20],opts);
  plot(sol3.x,sol3.y,'r'), drawnow

  lambda = 3.0;
  opts = ddeset('RelTol',1e-6,'AbsTol',1e-10);
  sol4 = dde23(@exam3f,1,@exam3h,[0, 20],opts);
  plot(sol4.x,sol4.y,'k'), drawnow
  
  legend('\lambda = 1.5','\lambda = 2.0',...
         '\lambda = 2.5','\lambda = 3.0')
  title('Example 4.2 of Oberle and Pesch.')
  hold off
  
  %-----------------------------------------------------------------------
  % Nested functions
  %

  function yp = exam3f(t,y,Z)
  %EXAM3F  The derivative function for the Example 3 of the DDE Tutorial.
    yp = -lambda*Z*(1 + y);   
  end % exam3f
  
  %-----------------------------------------------------------------------

  function y = exam3h(t)
  %EXAM3H  The history function for the Example 3 of the DDE Tutorial.
    y = t;
  end  % exam3h  

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

end  % exam3  

Contact us