Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

This example shows how to use `ddensd`

to
solve the initial value DDE presented by Jackiewicz [1] for
0 ≤ *t* ≤ 0.1.

Click `ddex5.m`

or
type `edit ddex5.m`

in a command window to view the
code for this example in an editor.

The equation is

*y* '(*t*)
= 2cos(2*t*) *y*(*t*/2)^{2cos(t) }+
log(*y* '(*t*/2)) – log(2cos(*t*))
– sin(*t*).

This is an initial value DDE because the delays are zero at *t*_{0}.
The initial conditions are:

*y*(0) =
1

*y* '(0) = *s*,

where *s* is
the solution of:

2 + log(*s*) –
log(2) = 0.

This equation is satisfied by *s*_{1} =
2 and *s*_{2} = 0.4063757399599599.

Create a new program file in the editor. This file will contain a main function and one local function.

Define the DDE as a local function.

function yp = ddefun(t,y,ydel,ypdel) yp=2*cos(2*t)*ydel^(2*cos(t))+log(ypdel)-log(2*cos(t))-sin(t); end

Define the solution delay and derivative delay. Add this line to the main function.

delay = @(t,y) t/2;

You can use one anonymous function to handle both delays since they are the same in the equation.

Define the initial conditions,

`y0`

and`s1`

, and the interval of integration,`tspan`

. Add this code to the main function.y0 = 1; s1 = 2; tspan = [0 0.1];

Solve the DDE for 0 ≤

*t*≤ 0.1, with initial conditions*y*(0) = 1, and*y*'(0) = 2. Add this code to the main function.sol1 = ddensd(@ddefun,delay,delay,{y0,s1},tspan);

Solve the equation again, this time using

*y*'(0) = 0.4063757399599599. Add this code to the main function.s2 = 0.4063757399599599; sol2 = ddensd(@ddefun,delay,delay,{y0,s2},tspan);

Plot the results. Add this code to the main function.

figure plot(sol1.x,sol1.y,sol2.x,sol2.y); legend('y''(0) = 2','y''(0) = .40638','Location','NorthWest'); xlabel('time t'); ylabel('solution y'); title('Two solutions of Jackiewicz''s initial-value NDDE');

Run your program to calculate and plot the solutions for each value of

*s*.

[1] Jackiewicz, Z. "One step Methods
of any Order for Neutral Functional Differential Equations." *SIAM
J. Numer. Anal.* Vol. 21, Number 3. 1984. pp. 486–511.

Was this topic helpful?