help-octave
[Top][All Lists]

## How to pass time-dependent vectors with lsode

 From: Ferdinando Subject: How to pass time-dependent vectors with lsode Date: Mon, 8 Aug 2016 11:02:25 -0700 (PDT)

```Hi Everyone,

I'm trying to solve this problem in Octave. I am working on a particle track
data where I can extract the information of local intensity (I) and time.
Now I want to pass these information to lsode where i calculate a first
order concentration (C) decay like this: dCdt = -k*I*C.
I have difficulties to pass the time-dependent vector I(t).
Can anyone help me in this?

Here an example:

time=[0 1 2 3 4 5];
I = [0 1 1 2 2 0];
local_time = [0 1 1 1 1 1];

C0 = 100;

y=lsode(@myODE,C0,time,I);

-------------------
function dCdt=myODE(x,time,I)
k = 0.01;

C = x(1);

dCdt = -k.*I.*C;

endfunction

--
View this message in context:
http://octave.1599824.n4.nabble.com/How-to-pass-time-dependent-vectors-with-lsode-tp4679062.html
Sent from the Octave - General mailing list archive at Nabble.com.

```