From: ISE_2001_entry on
A bit random question to ask in the middle of this but I am stuck with
this problem. If I want to increase/decrease/change a variable value at
every integration step, how should I go about it?

-Pantha.


Marc Compere wrote:
> As of May 2005 the link below locates several ODE solvers, at least 6
> of which will work in both Octave and Matlab.
>
> <http://octave.sourceforge.net/index/calculus.html#Ordinarydifferentialequations>
>
> The six (described below) were maintained as a package and kept at
> two sites that are now no longer working. The octave.sourceforge.net
> location will serve as the home for the latest and greatest versions.
>
> The original Readme.txt for the solver package is pasted below for
> reference.
> -----------------------------------------------
> This is the Readme.txt file for Octave m-file ordinary differential
> equation (ODE) solvers, version 1.15. They also work in Matlab.
>
> This directory contains 8 files that provide an Octave user with
> several options for numerically integrating ODE.
> There are 3 fixed-step Runge-Kutta algorithms and
> 3 variable step Runge-Kutta-Fehlberg algorithms along with
> a Dormand-Prince 4(5) pair used by default in ode45.m (as of
> version 1.09.)
> All are explicit RK formulas that work well with nonstiff or mildly
> stiff problems.
> All contain their own documentation accessable at the Octave (or
> Matlab) command prompt by typing 'help ode45' or 'help rk8fixed'
> or whichever solver you need help with.
>
> ----------------------------------------------------------------------
>
> The archive ode_v1.15.tar.gz contains 6 explicit single-step
> Runge-Kutta ODE solvers along with 2 files demonstrating example
> uses of each solver:
>
> - ode23.m : variable step, 2nd-3rd order
> - ode45.m : variable step, 4th-5th order
> - ode78.m : variable step, 7th-8th order
>
> - rk2fixed.m : fixed step, 2nd order
> - rk4fixed.m : fixed step, 4th order
> - rk8fixed.m : fixed step, 8th order
>
> - pendulum.m : a sample m-file script that runs all solvers
> - penddot.m : derivative function file, returning dy/dt for a
> simple pendulum
> - Readme.txt : this file
>
> ----------------------------------------------------------------------
>
> Steps for testing these ode solvers in Octave (version 2.0.15 or
> better),
> from a unix shell:
>
> (1) unzip and untar the archive:
> gunzip ode_v1.15.tar.gz
> tar xvf ode_v1.15.tar
> (2) change directories into the newly created directory and execute
> Octave:
> cd ode_v1.15
> octave
> (3) run the sample pemdulum script from within Octave.
> pendulum
>
> This script sequentially executes all 6 m-file integrators and, if
> plotting
> capability is setup properly, plots the output from all integrators.
>
> ----------------------------------------------------------------------
>
> I've made an effort to make these portable to most Octave
> installations
> as well as for use in most Matlab versions. These work with no
> modification
> in Matlab v5.2 & v5.3. If you want to use these in Matlab, however,
> you'll do yourself a favor by renaming ode45.m and ode23.m to
> something else,
> like ode45_octave.m and ode23_octave.m. This is because Matlab
> already has
> two integrators named ode45 and ode23.
> Don't forget to change the function names at the top of
> ode45_octave.m and
> ode23_octave.m as well.
>
> Some effort has been made to create ode45 and ode23 with similar
> argument structures to their Matlab counterparts. Only the most
> basic function
> calls to ode45 and ode23 match up in both Matlab's integrators and
> these.
> Feel free to change them as you see fit. You are welcome to mail me
> for useful
> change suggestions.
>
> ----------------------------------------------------------------------
>
> Basic differences between the integrators:
>
> In general, the higher the integration order, the smaller the local
> truncation
> error is at each time step. Small local truncation errors result in
> larger
> integration steps. This is demonstrated by ode78 generating far
> fewer
> steps than ode23 for solving the same problem over the same time
> interval with
> the same error criterion.
> The cost of the higher order integrators is the number of function
> evaluations
> required at each step. This results in longer execution t

From: Marc Compere on
You can use a global variable in the state derivative file.




ISE_2001_entry wrote:
> A bit random question to ask in the middle of this but I am stuck with
> this problem. If I want to increase/decrease/change a variable value at
> every integration step, how should I go about it?
>
> -Pantha.
>
>
> Marc Compere wrote:
> > As of May 2005 the link below locates several ODE solvers, at least 6
> > of which will work in both Octave and Matlab.
> >
> > <http://octave.sourceforge.net/index/calculus.html#Ordinarydifferentialequations>
> >
> > The six (described below) were maintained as a package and kept at
> > two sites that are now no longer working. The octave.sourceforge.net
> > location will serve as the home for the latest and greatest versions.
> >
> > The original Readme.txt for the solver package is pasted below for
> > reference.
> > -----------------------------------------------
> > This is the Readme.txt file for Octave m-file ordinary differential
> > equation (ODE) solvers, version 1.15. They also work in Matlab.
> >
> > This directory contains 8 files that provide an Octave user with
> > several options for numerically integrating ODE.
> > There are 3 fixed-step Runge-Kutta algorithms and
> > 3 variable step Runge-Kutta-Fehlberg algorithms along with
> > a Dormand-Prince 4(5) pair used by default in ode45.m (as of
> > version 1.09.)
> > All are explicit RK formulas that work well with nonstiff or mildly
> > stiff problems.
> > All contain their own documentation accessable at the Octave (or
> > Matlab) command prompt by typing 'help ode45' or 'help rk8fixed'
> > or whichever solver you need help with.
> >
> > ----------------------------------------------------------------------
> >
> > The archive ode_v1.15.tar.gz contains 6 explicit single-step
> > Runge-Kutta ODE solvers along with 2 files demonstrating example
> > uses of each solver:
> >
> > - ode23.m : variable step, 2nd-3rd order
> > - ode45.m : variable step, 4th-5th order
> > - ode78.m : variable step, 7th-8th order
> >
> > - rk2fixed.m : fixed step, 2nd order
> > - rk4fixed.m : fixed step, 4th order
> > - rk8fixed.m : fixed step, 8th order
> >
> > - pendulum.m : a sample m-file script that runs all solvers
> > - penddot.m : derivative function file, returning dy/dt for a
> > simple pendulum
> > - Readme.txt : this file
> >
> > ----------------------------------------------------------------------
> >
> > Steps for testing these ode solvers in Octave (version 2.0.15 or
> > better),
> > from a unix shell:
> >
> > (1) unzip and untar the archive:
> > gunzip ode_v1.15.tar.gz
> > tar xvf ode_v1.15.tar
> > (2) change directories into the newly created directory and execute
> > Octave:
> > cd ode_v1.15
> > octave
> > (3) run the sample pemdulum script from within Octave.
> > pendulum
> >
> > This script sequentially executes all 6 m-file integrators and, if
> > plotting
> > capability is setup properly, plots the output from all integrators.
> >
> > ----------------------------------------------------------------------
> >
> > I've made an effort to make these portable to most Octave
> > installations
> > as well as for use in most Matlab versions. These work with no
> > modification
> > in Matlab v5.2 & v5.3. If you want to use these in Matlab, however,
> > you'll do yourself a favor by renaming ode45.m and ode23.m to
> > something else,
> > like ode45_octave.m and ode23_octave.m. This is because Matlab
> > already has
> > two integrators named ode45 and ode23.
> > Don't forget to change the function names at the top of
> > ode45_octave.m and
> > ode23_octave.m as well.
> >
> > Some effort has been made to create ode45 and ode23 with similar
> > argument structures to their Matlab counterparts. Only the most
> > basic function
> > calls to ode45 and ode23 match up in both Matlab's integrators and
> > these.
> > Feel free to change them as you see fit. You are welcome to mail me
> > for useful
> > change suggestions.
> >
> > ----------------------------------------------------------------------
> >
> > Basic differences between the integrators:
> >
> > In general, the higher the integration order, the smaller the local
> > truncation
> > error is at each time step. Small local truncation errors result in
> > larger
> > integration steps. This is demonstrated by ode78 generating far
> > fewer
> > steps than ode23 for solving the same problem over the same time
> > interval with
> > the same error criterion.
> > The cost of the higher order integrators is the number of function
> > evaluations
> > required at each step. This results in longer execution t

From: Pantha on
Hi Marc,

I am using ode15s. Which one and where is the state derivative file. I
am not really used to MATLAB. Sorry if the question was silly.

regards,

Pantha.

From: Marc Compere on
To use an ode solver you will need to put the derivatives of your
differential equations in an auxiliary function. This function is no
different from any other function other than it must conform to a
certain set of inputs and outputs (see help on ode15s or whatever ode
solver you're using). If you can figure out how to get global
variables to work or how to use auxiliary inputs then you can use
either of those mechanisms to change parameters in your differential
equation derivative function.

See Matlab help on 'ode15s' or 'global'.

Marc

Pantha wrote:
>
>
> Hi Marc,
>
> I am using ode15s. Which one and where is the state derivative
> file. I
> am not really used to MATLAB. Sorry if the question was silly.
>
> regards,
>
> Pantha.
>
>
From: Benje. Marchand on
Hi,

I've developed a model in Simulink and I'm using the fixed-step
ode5(Dormand-Prince) routine for simulations. I've implemented a
higher order routine (similar to rk8fixed) and I'd like to know
whether it's possible to link this m-file routine to the drop-down
menu "Simulation Parameters" in Simulink?
(I was thinking that Perhaps if I put my upgraded routine back into
the Matlab directory, Simulink would automatically see it)

Thanks for your help