FUNCTION REFERENCE
mpcmove
Compute an optimal linear MPC move and update the controller state handle.
Compute an optimal linear MPC move and update the controller state handle.
Syntax
mv = mpcmove(c,s,ym,r[,v,options])Syntax
[mv,Info] = mpcmove(c,s,ym,r[,v,options])References have ny columns and 1..p rows; measured disturbances have nmd columns and 1..p+1 rows (current first). Repeat the last supplied row. Empty or omitted ym, r and v use nominal values. Default estimation corrects with M before optimization and advances the prior estimate with L afterward. Custom estimation leaves Plant, Disturbance and Noise for the caller to update. LastMove and handle aliases update in place.
The standard cost sums squared scaled weighted output errors, MV target errors and MV increments, plus Weights.ECR times Slack squared. Info.Cost includes constant terms, without a factor of 1/2. Public OV properties, weights, scales, bounds, reference columns and Yopt columns all use physical plant output order. Weights.ECR must be positive and finite. When any MVRate weight is zero and the move Hessian is singular or has condition above 1e12, add 20*sqrt(eps) to move-coordinate diagonals; Info.Cost excludes this numerical regularization. MV.Target defaults to the nominal MV. Scalar or vector blocking holds specified moves constant. Bounds use scaled ECR softening, with zero ECR meaning hard.
Info contains Uopt, Yopt, Xopt, Topt, Slack, Iterations, QPCode and Cost. Uopt/Yopt/Xopt have p+1 rows, the final Uopt row repeats, Xopt omits measurement-noise states, and trajectories use engineering units. Solver failure holds LastMove; Iterations is -1 for infeasibility, -2 for numerical failure, 0 for an iteration limit. QPCode is feasible, infeasible or unreliable; Cost is meaningful for feasible solutions.
Example
c=mpc(ss(.8,.2,1,0,.1)); s=mpcstate(c); [mv,Info]=mpcmove(c,s,0,1); Info.CostDifferences from MATLAB: Dense active-set QPs only; at most 200 blocked moves including slack, 4000 inequalities and 128 augmented states, with host workspace limits. Other algorithms and custom constraints are not supported here.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.