[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lsode for matrix DGLs?
From: |
Matthias Brennwald |
Subject: |
Re: lsode for matrix DGLs? |
Date: |
Fri, 22 Jun 2007 21:15:24 +0200 |
On 22.06.2007, at 19:07, address@hidden wrote:
I think you should use the ode's functions for that.
What do you mean by 'that'?
the lsode calculate
the jacob matrix, and you need partials, not only dt,
I hope this example will help.
Lotka- Volterra equations:
dx/dt=x*(a-b*y)
dy/dt=-y*(c-d*x)
making a function:
function ydot = lotkavolterra(t,y)
global a b c d
A= [ a -b*y(1)
d*y(2) -c ];
ydot = A*y;
in octave:
octave>a=1.5;b=1;c=3;d=1;
[t,y]=ode23(@lotkavolterra,[0 20],[2 2]);
Uhm, ode23 is from the competition, right?
plot(t,y(:,1))
hold on
plot(t,y(:,2))
So, y1 = y(:,1) and y2 = y(:,2) are two vectors reflecting two
_scalar_ functions of time t: y1(t) and y2(t)
What I'm after is two (or more) _matrix_ functions of time. I guess
Johns approach of reshaping my matrices to vectors should do the trick.
Cheers
Matthias
-------
Matthias Brennwald
Lägernstrasse 6
CH 8037 Zürich
+41 (0)44 364 17 03
address@hidden