Examine prediction model and custom functions of nlmpc
object for
potential problems
validateFunctions
tests the prediction model, custom cost,
custom constraint, and Jacobian functions of a nonlinear MPC controller for potential
problems. When you first design your nonlinear MPC controller, or when you make significant
changes to an existing controller, it is best practice to validate your controller
functions.
validateFcns(
specifies nominal parameter values. If your controller has parameters, you must specify
nlmpcobj
,x
,mv
,md
,parameters
)parameters
.
When you provide your own analytical Jacobian functions, it is especially important
that these functions return valid Jacobian values. If
validateFunctions
detects large differences between the values
returned by your user-defined Jacobian functions and the finite-difference approximation,
verify the code in your Jacobian implementations.
For each controller function, validateFunctions
checks whether the
function:
Exists on the MATLAB® path
Has the required number of input arguments
Can be executed successfully without errors
Returns the output arguments with the correct size and dimensions
Returns valid numerical data; that is, it does not return Inf
or
NaN
values
For Jacobian functions, validateFunctions
checks whether the returned
values are comparable to a finite-difference approximation of the Jacobian values. These
finite-difference values are computed using numerical perturbation.