VFGEN
  • Home
  • Download
  • Support & FAQ
  • User's Guide
  • §   Vector Field File
  • §   ADOL-C
  • §   AUTO
  • §   Check
  • §   CVODE
  • §   DDE23
  • §   DDE-BIFTOOL
  • §   DDE_SOLVER
  • §   Delay2ODE
  • §   DSTool
  • §   EVF
  • §   GSL
  • §   Help
  • §   LaTeX
  • §   MATCONT
  • §   MATLAB
  • §   Octave
  • §   PyDSTool
  • §   PyGSL
  • §   RADAU5
  • §   Scilab
  • §   SciPy
  • §   Taylor
  • §   XPP

Octave

From the Octave web page: "GNU Octave is a high-level language, primarily intended for numerical computations. It provides a convenient command line interface for solving linear and nonlinear problems numerically, and for performing other numerical experiments using a language that is mostly compatible with Matlab."

The VFGEN Octave Command

An Octave file is created by the command

$ vfgen octave vector_field_file.vf

This command creates the file [name].m, where [name] is the name given in the vector field file. The following table shows the Octave functions created by VFGEN octave command. N is the dimension of the system specified in the vector field file, t is time (a scalar), x is the N dimensional state vector, and p is the parameter vector.

Octave Function Description
vf = [name]_vf(x,t) The vector field function. This returns an Nx1 column vector.
jac = [name]_jac(x,t) The Jacobian function. This returns an NxN matrix.
r = [name]_[userfunc](x,t,p) Each user function specified in the vector field file results in its own Octave function. The return value is a scalar. (Note that these function take the parameters as the vector argument p. They do not use the global variable [name]_parameters.)
These functions are only created if the option func=yes is given in the command line.

The lsode function does not provide a method for passing parameters to the vector field and Jacobian functions. To allow for parameters to be available to these functions, the VFGEN code uses a global variable. The name of the variable is [name]_parameters. It is a vector that holds the parameters in the order in which they were defined in the vector field file.

Before using the lsode function, your script must assign the parameter values to this global vector. For example, if the vector field named mysystem has the parameters a, b, and epsilon (defined in that order), your script should have code like this

global mysystem_parameters;
mysystem_parameters(1) = a;
mysystem_parameters(2) = b;
mysystem_parameters(3) = epsilon;
before using the functions defined in Octave file created by VFGEN.

Options

func If the option func=yes is given, an Octave function will be created for each user-defined function.
Default: func=no
demo If the option demo=yes is given, a second file is created called [name]_demo.m. It will call the lsode function and plot the solution. It uses the default initial conditions and parameters values defined in the vector field file. Run the script in Octave with the command
octave:1> [name]_demo

Default: demo=no

Example

Here is a sample vector field file: vanderpol.vf.
The files created by
$ vfgen octave:func=yes,demo=yes vanderpol.vf

are
  • vanderpol.m
  • vanderpol_demo.m
To run the demonstration program, enter the command
octave:1> vanderpol_demo
in Octave. For example, here is a screenshot of the plot created by vanderpol_demo.m:

Copyright © 2005-2007 Warren Weckesser