=ODEVAL(col1, exprn, opr, pt, [options])
ODEVAL to compute a single value from a solution array obtained by any of the ordinary differential equations solvers.
ODEVAL computes the value using a specified calculus operation including interpolation, differentiation or integration.
In a dynamical optimization problem,
ODEVAL can be used to define dynamic constraints on the solution array of the ordinary differential equations solver.
A constraint formula is typically defined as the difference between the computed value by ODEVAL and a target value. The constraint formulas are input to
col1 a reference to the first column in the solution array. This defines the time or spatial range for the calculus operation.
You may select a sub range of column 1 although this reduces the accuracy of the calculus operation.
exprn a reference to the operand for the calculus operation.
The reference may be to single variable or a formula implicating mulutiple variables. If your operand is a single variable, just pass its name in this argument.
opr a string value specifying the calculus operation to perform. Supported values are
INTERP, DERIV, and INTEG.
pt defines the point of interpolation or differentiation for the calculus operation.
Not required if the calculus operation is INTEG.
order controls the calculus operation as described below:
opr is INTERP or INTEG
Enter 1 to use linear splines, or 3 to use cubic splines. Default is 3.
opr is DERIV
Enter the derivative order: 1, 2 or 3. Default is 1.
Consider the array result shown in Table 1 from the simulation of an initial value pendulum problem with IVSOLVE
With the following parameters:
You can use ODEVAL() to extract or compute values of interest from the simulation result:
|Find derivative of omega at t = 0.5||
|Integrate theta from 0 to 1||
|Interpolate theta at t = 0.5||
|Integrate the square of omega from 0 to 1||
When solving a parametrized dynamical optimization problem, ODEVAL is used to define constraints on the dynamical system solution typically as the difference between a computed value by ODEVAL and a target value. You can then use the nonlinear solver NLSOLVE to find optimal values for the design parameters that will minimize the differences your defined constraints.