help-octave
[Top][All Lists]

## Re: Help with ODE solver

 From: Douglas Eck Subject: Re: Help with ODE solver Date: Thu, 12 Sep 2002 09:05:18 +0200 User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1b) Gecko/20020722

```Hi Marco,
My experience is that it's better to break down the integration into
intervals. Also, if you later need to speed up your code some, it can
be much faster to write the xdot = f(x,t) as a compiled .oct file.

Marco Antoniotti wrote:
```
```Hi

I am using the LSODE solver for my research and now need to do the
following.

At a time t_i, I need to change the value of one (or more) of the
variable(s) involved.

I think I understand I have two avenues to follow to achieve this
goal, but, given my inexperience with Octave (and/or Matlab) I don't
know which is the best one.

1 - I could insert a specific test in the derivative function

function xdot = f(x, t)
xdot = zeros(rows(x), 1);

if (t == t_i)
## set x(k) to M
endif

xdot(1) = ...
...
xdot(n) = ...

endfunction

2 - I could break down the integration into intervals and set the
variable value between integrations.

I'd like some comments about what would be the "best" (for an
approrpiate definition of "best") way to achieve this goal.

Thanks

```
```

--
Dr. Douglas Eck, http://www.idsia.ch/~doug
Istituto Dalle Molle di Studi sull'Intelligenza Artificiale (IDSIA)
Neural Networks, Rhythm Perception and Production, Dynamical Systems

-------------------------------------------------------------
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
-------------------------------------------------------------

```