If your problem has discontinuities, it's best to communicate them to the solver using an options structure. To do this, use the ddeset function to create an options structure containing the discontinuities in your problem.
There are three properties in the options structure that you can use to specify discontinuities; InitialY, Jumps, and Events. The property you choose depends on the location and nature of the discontinuities.
Nature of Discontinuity
At the initial value t = t0
Generally the initial value y(t0) is the value S(t0) returned by the history function, meaning the solution is continuous at the initial point. If this is not the case, supply a different initial value using the InitialY property.
In the history, i.e., the solution at t <t0, or in the equation coefficients for t >t0
Provide the known locations t of the discontinuities in a vector as the value of the Jumps property. Applies only to dde23.
dde23, ddesd, and ddensd use the events function you supply to locate these discontinuities. When the solver finds such a discontinuity, restart the integration to continue. Specify the solution structure for the current integration as the history for the new integration. The solver extends each element of the solution structure after each restart so that the final structure provides the solution for the whole interval of integration. If the new problem involves a change in the solution, use the InitialY property to specify the initial value for the new integration.