How can I define and pass a history prior to t0 to dde23 ?
5 views (last 30 days)
Show older comments
In the documentation on dde23, it mentions that you can pass a history defined at t ≤ t0 to the solver, but in the examples it seems t ≤ 0 is the default for history. How can I change it from zero to t0?
Here's the example from the documentation:
function ddex1
%DDEX1 Example 1 for DDE23.
% This is a simple example of Wille' and Baker that illustrates the
% straightforward formulation, computation, and plotting of the solution
% of a system of delay differential equations (DDEs).
%
% The differential equations
%
% y'_1(t) = y_1(t-1)
% y'_2(t) = y_1(t-1)+y_2(t-0.2)
% y'_3(t) = y_2(t)
%
% are solved on [0, 5] with history y_1(t) = 1, y_2(t) = 1, y_3(t) = 1 for
% t <= 0.
%
% The lags are specified as a vector [1, 0.2], the delay differential
% equations are coded in the subfunction DDEX1DE, and the history is
% evaluated by the function DDEX1HIST. Because the history is constant it
% could be supplied as a vector:
% sol = dde23(@ddex1de,[1, 0.2],ones(3,1),[0, 5]);
%
% See also DDE23, FUNCTION_HANDLE.
% Jacek Kierzenka, Lawrence F. Shampine and Skip Thompson
% Copyright 1984-2004 The MathWorks, Inc.
sol = dde23(@ddex1de,[1, 0.2],@ddex1hist,[0, 5]);
figure;
plot(sol.x,sol.y)
title('An example of Wille'' and Baker.');
xlabel('time t');
ylabel('solution y');
% --------------------------------------------------------------------------
function s = ddex1hist(t)
% Constant history function for DDEX1.
s = ones(3,1);
% --------------------------------------------------------------------------
function dydt = ddex1de(t,y,Z)
% Differential equations function for DDEX1.
ylag1 = Z(:,1);
ylag2 = Z(:,2);
dydt = [ ylag1(1)
ylag1(1) + ylag2(2)
y(2) ];
Here's my own code:
t = [0:3000];
lags = 0.1;
hist = @(t) 0.000000001;
r = 0.1;
rm = 0.015;
Ka = 0.5;
Kb = 7;
K0 = 0.501;
sol = dde23(@(t,N,Nlag)Bilogistic(t,N,Nlag,Ka,Kb,r,rm,K0),lags,hist,[0,3000]);
tint = linspace(0,3000);
yint = deval(sol,tint);
plot(tint,yint,'r');
I would like to change the history so it reflects the range (-inf,t0).
Answers (0)
See Also
Categories
Find more on Delay 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!