From help-request at octave dot org Mon Oct 18 05:14:50 2004 Subject: Re: passing parameters to a funcion with lsode From: David Bateman To: roger baig =?iso-8859-1?Q?vi=F1as?= Cc: help at octave dot org, help-octave@bevo.che.wisc.edu, Geordie McBain Date: Mon, 18 Oct 2004 12:10:50 +0200 Reading lsode.cc if (nargin > 2 && nargin < 5 && nargout < 4) { } else print_usage ("lsode"); There is no other way to pass the args to the function. The function itself is called by the the fortran function lsode that has an inflexible interface and so what you want can't be done... D. According to roger baig viņas (on 10/18/04): > Geordie, > > That's the way I though it could be solved, but I don't like the idea of > using global variables, basically for two reasons: first because then > functions can't be reused if I don't use the same name for that > variables defined as global, and second, because I've alway been thougth > that global vars must be avoid (basically due to the first argument, I > think). > > Any other solution to pass parameters to a function called by lsode. > > P.S. thanks any way. If I don't fine any other way to do it I'll use > your suggestion. > > En/na Geordie McBain ha escrit: > >This can be done quite easily with global variables. Declare the > >parameters global at the top level and inside the function. Set them at > >the top level before the function is called. Then your function can be > >unary, as required by lsode. > > > >See 'Variables/Global variables' in the manual for further details. > > > >On Mon, 2004-10-18 at 04:17, roger baig viņas wrote: > > > >>I would like to know if it is possible to pass parameters to the > >>function that is called from lsode, and if it is, how can i do it. > >> > >>I should use lsode like follows: > >> > >>Xd=lsode("dxdt_tancDoble_mf",x_0,t) > >> > >>with dxdt_tancDoble_mf function that has a header like: > >> > >>function dxdt=dxdt_tancDoble_mf(t,x,u,param) > >> > >> > >>Thank you very much > >> > >> > >> > >>------------------------------------------------------------- > >>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 > ------------------------------------------------------------- -- David Bateman David dot Bateman at motorola dot com Motorola CRM +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax) 91193 Gif-Sur-Yvette FRANCE The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary ------------------------------------------------------------- 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 -------------------------------------------------------------