[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lsode
From: |
Sigfrid Lundberg |
Subject: |
lsode |
Date: |
Thu, 24 Jun 93 22:18 MET DST |
I'm a newbie octave user. Everything seem to work as expected, but there
is one I don't understand. I have written a tiny function:
function xdot = volterra ( x , t)
#
# Integrate lotka-volterra
#
global x xdot;
r = 0.25;
k = 1.4;
a=1.5;
b=0.16;
c=0.9;
d=0.8;
xdot (1) = r*x (1) * (1 - x (1)/k) - a*x (1)*x (2)/(1+b*x (1));
xdot (2) = c*a*x (1)*x (2)/(1+b*x (1))-d*x (2);
endfunction
Then I start octave, and load this function:
Octave, version 0.72. Copyright (C) 1992, 1993, John W. Eaton.
This is free software with ABSOLUTELY NO WARRANTY.
For details, type `warranty'.
octave:1> eval("volterra");
error: `x' undefined
octave:2> x=[1;6]
x =
12
6
I can evaluate this function
octave:4> volterra(x,5)
ans =
-59.701
28.488
But, if I try to use lsode for solving this predator-prey model
octave:18> x=[1;6]
x =
1
6
octave:19> lsode ('volterra',x,30,0.01)
ans =
1 6
nothing interesting happens. What am I doing wrong?
Regards,
Sigfrid
- lsode,
Sigfrid Lundberg <=