[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help with ODE solver
From: 
John W. Eaton 
Subject: 
Re: Help with ODE solver 
Date: 
Thu, 12 Sep 2002 19:18:38 0500 
On 12Sep2002, Marco Antoniotti <address@hidden> wrote:
 Pardon my obtuseness. Do you mean that I will have to have a big 'if'
 in the RHS function like

 if (t < t_crit_1)
 ...
 elseif (t_crit_1 <= t && t < t_crit_2)
 ...
 elseif (t > t_crit_k)
 ...
 end

 and call

 result = lsdot('RHS', intial_conditions, timesteps, [t_crit_1; t_crit_2
... t_crit_k]);

 ?
Yes, that would be one way, but then you would need to make all those
t_crit_N values global. It might make more sense to use a vector of
values and a loop in your RHS function. Or, you could vectorize it
depending on how your timedependent parameter values are stored.
Perhaps someone else on the list can help you with the programming
details.
My reason for responding in this thread was to point out that using
tcrit with lsode is important if you have a discontinuity in the
derivative due to changing parameter values. Simply breaking up the
integration into intervals may not be sufficient because if you don't
specify tcrit, lsode may integrate past your final time point and
interpolate backward to find the final state values. If you have a
discontinuity there, then the integrator may still have trouble,
respond by reducing the step size to zero, and eventually fail.
BTW, does anyone know if Matlab's ODE solvers have a similar
capability?
jwe

Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html

 Re: Help with ODE solver, (continued)
 Re: Help with ODE solver, Michael Hanke, 2002/09/12
 Re: Help with ODE solver, Douglas Eck, 2002/09/12
 Re: Help with ODE solver, John W. Eaton, 2002/09/12
 Re: Help with ODE solver, Marco Antoniotti, 2002/09/12
 Message not available
 Re: Help with ODE solver, John W. Eaton, 2002/09/12
 Re: Help with ODE solver, Marco Antoniotti, 2002/09/12
 Re: Help with ODE solver, John W. Eaton, 2002/09/12
 Re: Help with ODE solver, Marco Antoniotti, 2002/09/12
 Re: Help with ODE solver,
John W. Eaton <=
 Re: Help with ODE solver, Marco Antoniotti, 2002/09/13
 Re: Help with ODE solver, John W. Eaton, 2002/09/13
 Re: Help with ODE solver, Jon Davis, 2002/09/13
 Re: Help with ODE solver, Marco Antoniotti, 2002/09/13
 Re: Help with ODE solver, Martin Senator, 2002/09/12