lsode and random term

William Christopher Carleton williamcarlet at trentu.ca
Sat Nov 22 12:10:42 CST 2008


Hi all,

I have a function (below), which includes a random term (I wrote a function 'random(x)' that just uses rand() to produce a value between -x and x b/c I couldn't find such an existing function in Octave's manual) and when I use lsode to solve it occasionally works, but often produces as error about convergence; 

LSODE--  AT T (=R1) AND STEP SIZE H (=R2), THE    
       CORRECTOR CONVERGENCE FAILED REPEATEDLY     
       OR WITH ABS(H) = HMIN   
      In above,  R1 =  0.3220694060927D+03   R2 =  0.1207113904987D-05
error: lsode: repeated convergence failures (t = 322.069perhaps bad jacobian supplied or wrong choice of integration method or tolerances)
error: evaluating assignment expression near line 10, column 2

Can anyone tell me why the random term has caused this problem and what I can do about it? I want the random term, or I suppose an unpredictable function with magnitude of fluctuations determined by a variable selected before solving, to simulate unpredictable environmental fluctuations. Thanks,

Chris

Octave Code:

function xdot=f(x,t);
k=0.01;
c=.9;
p=0.025;
l=0.5;
C=1000;
r=0.001;
s=1.1;
d=0.002;
v=1;
E=random(1) * v;
xdot(1)=x(1) * (k * (x(3) - x(1)));
xdot(2)=(x(2) * -d * x(1) * E) + (r * x(2) * ((C - x(2)) / x(2)));
xdot(3)=x(2) * (x(1) * l) * p * (((x(2) * s) - x(3)) / (x(2) * s)) - (c * x(1));
endfunction






More information about the Help-octave mailing list