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

MATLAB

According to the MATLAB web page, "MATLAB is a high-level language and interactive environment that enables you to perform computationally intensive tasks faster than with traditional programming languages such as C, C++, and Fortran."

The VFGEN MATLAB Command

A set of MATLAB files are created by the command

$ vfgen matlab vector_field_file.vf

The following table shows the MATLAB files created by VFGEN when used in the MATLAB command. (Replace [name] with the name given in the vector field file.) 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.

File MATLAB Function Description
[name]_vf.m vf = [name]_vf(t,x,p) The vector field function. This returns an Nx1 column vector.
[name]_jac.m jac = [name]_jac(t,x,p) The Jacobian function. This returns an NxN matrix.
[name]_jacp.m jacp = [name]_jacp(t,x,p) This function computes the Jacobian with respect to the parameters. This returns an NxP matrix, where P is the number of parameters.
[name]_hess.m hess = [name]_hess(t,x,p) The Hessian function. This returns an NxNxN matrix.
[name]_der3.m der3 = [name]_der3(t,x,p) The third derivatives of the vector field. This returns an NxNxNxN matrix.
[name]_evf.m evf = [name]_evf(t,w,p) A function that computes the extended vector field consisting of the original vector field and the variational equations. This returns a 2N dimensional column vector. (Note: After implementing this, I added the EVF command to VFGEN. The EVF command is probably a better alternative, because you can then use VFGEN to create the Jacobian of the extended vector field.)
[name]_[userfunc].m r = [name]_[userfunc](t,x,p) Each user function specified in the file results in its own MATLAB function. The return value is a scalar.

Options

parstyle The method by which parameters are passed to the MATLAB functions generated by VFGEN is controlled by the parstyle option. If the option parstyle=list is given, for example like this
$ vfgen matlab:parstyle=list vector_field_file.vf
then each parameter is listed explicitly as an argument of the MATLAB functions. That is, instead of [name]_vf(t,x,p), the vector field function will be [name]_vf(t,x,param1,param2,...,paramM).
Default: parstyle=vector
evf If the option evf=yes is given, the file named [name]_evf.m is created.
Default: evf=no
func If the option func=yes is given, a MATLAB function is created for each user-defined function.
Default: func=no
demo If the option demo=yes is given, the file [name]_demo.m is created. This script will create a window that contains data fields in which the parameters and initial conditions may be changed, and a "Go" button that will generate a plot of the solution.
Default: demo=no

Example

Here is a sample vector field file: pendulum.vf.
The files created by

$ vfgen matlab:demo=yes,func=yes pendulum.vf

are
  • pendulum_vf.m
  • pendulum_jac.m
  • pendulum_jacp.m
  • pendulum_hess.m
  • pendulum_der3.m
  • pendulum_energy.m
  • pendulum_demo.m
Here is a screenshot of the script pendulum_demo.m in action.
Copyright © 2005-2007 Warren Weckesser