help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: How to keep lsode from returning to toplevel at errors?


From: Hall, Benjamin
Subject: RE: How to keep lsode from returning to toplevel at errors?
Date: Thu, 17 Nov 2005 08:03:02 -0500

Would a try - catch block help.  For example

try
  x = 1;
  error("this is an error message");
catch
  disp("An error occurred!")
end

This would allow you to "catch" the error and try something different, maybe
like

parm = 0.01;
no_good = 1;
while ( no_good )
  parm = 1.1*parm;

  try
    myfunc(parm);
    no_good = 0;
  catch
    no_good = 1;
  end

end


-----Original Message-----
From: Olaf Till [mailto:address@hidden
Sent: Thursday, November 17, 2005 3:58 AM
To: address@hidden
Subject: How to keep lsode from returning to toplevel at errors?


Hello,

I am rather new to octave.

Problem: My optimization routine calls lsode many times with a
differential equation whose parameters are changed from call to
call. In some of these calls (with "stiff" and the default option
values) lsode hangs. Setting a suitable "initial step width" prevents
lsode from hanging, but this suitable value is different from call to
call (with different parameters for the differential equation) and I
can not predict it.

How I try to solve it: If the value for "minimal step width" is set
from the default 0 to some (small) non-zero value, lsode will return
an error in the cases in which it before that had just hung. This
should provide the possibility to loop through a set of "initial step
width" values until a suitable one is found.

However, since lsode returns an error in these cases instead of just
setting istate to an error value, control is returned to top level,
not to my script. Here is the error message:

 LSODE--  AT T (=R1) AND STEP SIZE H (=R2), THE    
       CORRECTOR CONVERGENCE FAILED REPEATEDLY     
       OR WITH ABS(H) = HMIN   
      In above,  R1 =  0.8688561900806E-01   R2 =  0.1000000000000E-09
error: invalid vector index = 58
error: evaluating argument list element number 2
error: evaluating for command near line 143, column 1
error: called from ......

My question: Could someone point me to a place in the source where I
could hack lsode for me not to return a real error message in this
case (or just in any case)? I got a bit lost in the code. Or possibly
someone has a better solution?



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



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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]