Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ode solver w/dirac delta

364 views
Skip to first unread message

Harold Blumenthal

unread,
Oct 30, 2006, 4:32:11 PM10/30/06
to
Hello:

I'm trying to use one of the ode solvers (say, ode45) to solve a
system of ODEs, some of which involve Dirac deltas. Here's a
simplified example:

%------- begin code -------%
function dy = temp(t,y)

dy = mu*dirac(t - 3)*sin(t);
%-------- end code --------%

Now I realize that this ODE is easily solved by hand, but because the
differential equations are coupled, it's more or less impossible to
solve all of them. (In the above example you can assume that, say,
the parameter mu depends on variables from other differential
equations.) The problem is that Matlab's ode solvers don't seem to
work with the 'dirac' function--though they like the 'heaviside'
function just fine. Is there an ode solver or a method that works
for the above example?

Thanks,

HB

Greg von Winckel

unread,
Nov 2, 2006, 5:23:14 PM11/2/06
to

If you have a system of ODEs where the delta function appears as a
forcing term or coefficient, simply subdivide the time interval into
a series of subintervals such that the deltas always fall on the
endpoints of an interval. Now you simply solve the ODE system from
t=0 to the time of the first delta, determine the appropriate jump in
the data and use this time as the initial time for solving over the
next subinterval.

HTH,

Greg

Harold Blumenthal

unread,
Nov 3, 2006, 2:45:22 PM11/3/06
to
Ah, that's a very good idea. It certainly does help.

Many thanks,

HB

0 new messages