Error message examples
The Gradient is non-numeric. an explicit expression for the Gradient (the first derivative of the objective function) was specified to NlpDefine. When that expression was evaluated, the result contained a non-numeric value.
As the error states, the expression passed as the gradient of the objective function evaluated to a non-numeric value. The «Gradient» parameter passed to the NlpDefine function is an optional parameter that must evaluate to a numeric value and helps the engine solve the problem.
Correct the expression passed as the gradient to the objective to the NlpDefine function.