A criterion function enables you to define a simple constraint formula on an array solution obtained by any of the differential equation’s solvers. A constraint formula typically computes the difference between a value from your obtained solution and your desired value. Once you have defined all necessary constraint formulas, you can use NLSOLVE to solve the system of constraints formulas to obtain optimal values for the model parameters which can include any parameters that influence the system behavior.
You can use any of the following criterion functions to define constraints of varying complexity on your system solution array:
ARRAYVAL: Use to define a constraint on a single value or on a descriptive property (e.g., maximum or minimum) of a range of values from the system simulation results array.
ODEVAL: Use to define a constraint on the array solution obtained by ODE solvers IVSOLVE or BVSOLVE. You can define a complex constraint with ODEVAL, for example, on an interpolated or differentiated value from the array solution.
NLSOLVE interprets (equality and inequality) constraints formulas in relation to zero. You can specify a criterion constraint formula in the following form:
= Criterion function value – Target Value
Let the array below represent the results of an initial value problem simulation using IVSOLVE.
Suppose we want to constrain the value in B5 (which corresponds to the value of Disp at Time =0.3 to be 0.5. We can specify a simple constraint using ARRAYVAL :
=ARRAYVAL(B5) - 0.5
Suppose we want to constrain the value of the variable Disp at Time=0.35 to be 0.6. Since 0.35 falls between A5 and A6 we can use ODEVAL to define a constraint which uses interpolation as follows:
=ODEVAL(A2:A12, Disp, "INTERP", 0.35) – 0.6
In a parametric optimization, NLSOLVE will find optimal values for your design parameters that will drive your defined constraints to zero.