Main Content

odeDelay

ODE delay definition

Since R2025a

    Description

    An odeDelay object defines delays introduced in a differential equation and the history while solving a delay differential equation (DDE) using an ode object.

    Create an ode object to represent an ODE problem, and specify an odeDelay object as the value of the DelayDefinition property to define the delays for the DDE.

    Creation

    Description

    D = odeDelay creates an odeDelay object with empty properties.

    D = odeDelay(PropertyName=Value) specifies one or more property values using name-value arguments. For example, D = odeDelay(History=[0.1; 0.5]) defines the solution history [0.1; 0.5] for a DDE.

    example

    Properties

    expand all

    Solution history at tt0, specified as a function handle or vector.

    If you specify a handle to a function y = solhist(t) or y = solhist(t,p), then the function must return a column vector for a scalar t and an array p that represents the parameters specified by the Parameters property of the ode object.

    To define a constant solution history, specify a vector.

    Example: @ddeHist

    Example: [1; 0.4; 0.2]

    Data Types: single | double | function_handle

    Solution delays, specified as a function handle that returns a vector of delays in y, or as a vector of constant delays.

    If you specify ValueDelay as a function handle, the syntax must be dy = vdelay(t,y) or dy = vdelay(t,y,p), where the arguments are defined as described in this table.

    ArgumentDescription
    tA scalar value that represents the current value of time t
    yA vector that represents y(t). The size of this vector is n-by-1, where n is the number of equations in the system you want to solve.
    pAn array that represents the parameters specified by the Parameters property of the ode object
    dyA vector, returned by the vdelay function, whose values are the solution delays. The size of this vector must be p-by-1, where p is the number of solution delays in the equation. Each element of dy must be less than or equal to t.

    To define constant solution delays of the form dyi = tτi, specify ValueDelay as a vector, where ValueDelay(i) = τi. Each value in this vector must be greater than or equal to zero.

    Data Types: single | double | function_handle

    Derivative delays, specified as a function handle that returns a vector of delays in yp, or as a vector of constant delays.

    If you specify SlopeDelay as a function handle, the syntax must be dyp = sdelay(t,y) or dyp = sdelay(t,y,p), where the arguments are defined as described in this table.

    ArgumentDescription
    tA scalar value that represents the current value of time t
    yA vector that represents y(t). The size of this vector is n-by-1, where n is the number of equations in the system you want to solve.
    pAn array that represents the parameters specified by the Parameters property of the ode object
    dypA vector, returned by the sdelay function, whose values are the derivative delays. The size of this vector must be q-by-1, where q is the number of derivative delays in the equation. Each element of dyp must be less than t, with one exception—if you are solving an initial value DDE, the value of dyp can equal t at t = t0. For more information, see Initial Value Neutral Delay Differential Equations.

    To define constant derivative delays of the form dypj = tτj, specify SlopeDelay as a vector, where SlopeDelay(j) = τj. Each value in this vector must be greater than zero, with one exception—if you are solving an initial value DDE of neutral type, a value in SlopeDelay can equal zero at t = t0. See Initial Value Neutral Delay Differential Equations for more information.

    Data Types: single | double | function_handle

    Examples

    collapse all

    Solve this system of delay differential equations (DDEs) by creating an ode object to represent the problem.

    y1(t)=-2y1(t-2)+y2(t)y2(t)=y1(t)-2y2(t-1)

    Define the system of DDEs as a local function named ddefun.

    function dydt = ddefun(t,y,Z)
    ydelay1 = Z(:,1);
    ydelay2 = Z(:,2);
    dydt = [-2*ydelay1(1) + y(2);
            y(1) - 2*ydelay2(2)];
    end

    Specify the system of equations in the ODEFcn property of an ode object. Specify the time delays as a vector [2; 1] and the solution history as a vector [0.1; 0.5] in the DelayDefinition property by using an odeDelay object.

    F = ode;
    F.ODEFcn = @ddefun;
    F.DelayDefinition = odeDelay(ValueDelay=[2; 1],History=[0.1; 0.5]);

    Solve the system of equations over the time interval [0 10] by using the solve method. Plot the results.

    S = solve(F,0,10);
    plot(S.Time,S.Solution,"-o")

    Figure contains an axes object. The axes object contains 2 objects of type line.

    Version History

    Introduced in R2025a

    See Also

    Objects

    Functions