fmincon solver for nmpc applications

-I am developing an NMPC inside a Matlab funcion in simulink by using fmincon. Could I supply the Hessian Matrix as an input in the same way as in the gradient of the cost funcion and the constraints? Because I have created a function and a introduce the command in optimotions :
options = optimoptions('fmincon', ...
'Display', 'none', ...
'Algorithm', 'sqp', ...
'SpecifyObjectiveGradient', true, ...
'SpecifyConstraintGradient', true, ...
'HessianFcn',Hessfcn,...
'ConstraintTolerance', 1e-6, ...
'OptimalityTolerance', 1e-6, ... % usar OptimalityTolerance en vez de FunctionTolerance
'StepTolerance', 1e-6, ... % evita detenerse prematuramente
'MaxIterations', 400);
An the following error is displayed:
Error:'HessianFcn' is not a recognized parameter. For a list of valid name-value pair arguments, see the documentation for this function.
Function 'Variant Subsystem/NMPC Torque /NMPC Torque' (#635.1485.1950), line 49, column 11:
"optimoptions('fmincon', ..."
Launch diagnostic report.
-An another question, my NMPC is based on a single shooting formulation, could I introduce also non linear constraints such ceq and cineq as in the multiple shooting?

Answers (1)

Matt J
Matt J on 27 Jul 2026
Edited: Matt J on 27 Jul 2026
FMINCON's sqp algorithm does not accept a HessianFcn parameter. You would need to switch to either trust-region-reflective or interior-point.
Of these, only interior-point allows nonlinear constraints,
so that might be preferable in view of your second question.

Products

Release

R2025a

Asked:

on 27 Jul 2026

Edited:

on 27 Jul 2026

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!