From help-octave-request at bevo dot che dot wisc dot edu Sun Nov 23 20:29:54 2003 Subject: Re: Passing parameters to ODEs From: Geordie McBain To: eiffleduarte at petrobras dot com dot br CC: help-octave at bevo dot che dot wisc dot edu Date: Mon, 24 Nov 2003 13:25:50 +1100 > I am new to Octave and been trying to run my Matlab code under it. > Can I pass parameters to ODEs without using globals? I tried this > with ode45, but it didn't work. I looked the help for lsode and it > also does not give me such an option. Is there a way to do it? > Also, are there any optimization routines that allow me to pass > parameters to the objective functions without using globals? > Sincerely, > Marcus Vinicius Eiffle Duarte Here are two ways to pass parameters to ODEs. 1) Say the ODE depends on a parameter p. Append p as a dependent variable and give it the evolution equation dp/dt=0 and the appropriate initial condition. 2) Try Octave's odessa function instead of lsode. Call is [X, SX, ISTATE, MSG] odessa (FCN, X_0, P, SX_0, T, T_CRIT) where P is a vector of parameters; see under `Differential Equations/Ordinary Differential Equations' in the manual for more information. ------------------------------------------------------------- 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 -------------------------------------------------------------