[ Team LiB ] Previous Section Next Section

M3.2 MATLAB ode—Options

The MATLAB integration routines have additional options (such as changing the default tolerances for integration) that can be set by the user. Also, parameters for the differential equations may be passed through the argument list to the function m-file.


[t,x]= ode45('xprime',tspan,x0,options,P1,P2,...)
[t,x]= ode23('xprime',tspan,x0,options,P1,P2,...)
[t,x]= ode113('xprime',tspan,x0,options,P1,P2,...)
[t,x]= ode15s('xprime',tspan,x0,options,P1,P2,...)
[t,x]= ode23s('xprime',tspan,x0,options,P1,P2,...)
[t,x]= ode23t('xprime',tspan,x0,options,P1,P2,...)
[t,x]= ode23tb('xprime',tspan,x0,options,P1,P2,...)

To use the default options (generally recommended) and pass through parameter values, simply enter [ ] for the options element in the argument list. For example, create an 'xprime.m' m-file for the differential equation


function xdot = xprime(t,x,P1,P2,...)
...

and enter


[t,x]= ode45('xprime',tspan,x0,[ ],P1,P2,...);

in the MATLAB command window.

A typical application might be to be able to change the magnitude of an input variable. For example, consider the van de Vusse reactor shown in Example M3.1. The first line of the vdv_ode.m file could be modified in the fashion


function xdot = vdv_ode(t,x,delstep);

where delstep represents the change in the manipulated input. The file is further modified by changing the following line


fov = 4/7 + delstep;   % dilution rate (min^-1)

so that delstep represents a change from the nominal input value of 4/7 min-1. If the magnitude of the step change is 0.1, then the line entered in the MATLAB command window is


[t,x]= ode45('vdv_ode',[0 5],x0,[ ],0.1)
    [ Team LiB ] Previous Section Next Section