| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Model Predictive Control Toolbox |
| Contents | Index |
Standard Form
Assume that the estimates of x(k), xd(k) are available at time k (for state estimation, see State Estimation). The model predictive control action at time k is obtained by solving the optimization problem
|
(2-3) |
where the subscript "( )j" denotes the j-th component of a vector, "(k+i|k)" denotes the value predicted for time k+i based on the information available at time k; r(k) is the current sample of the output reference, subject to

with respect to the sequence of input increments {
u(k|k),...,
u(m-1+k|k)} and to the slack variable
, and by setting u(k)=u(k-1)+
u(k|k)*, where
u(k|k)* is the first element of the optimal sequence.
| Note Although only the measured output vector ym(k) is fed back to the model predictive controller, r(k) is a reference for all the outputs (measured and unmeasured). |
When the reference r is not known in advance, the current reference r(k) is used over the whole prediction horizon, so r(k+i+1)=r(k) in Equation 2-3. In model predictive control the exploitation of future references is referred to as anticipative action (or look-ahead or preview). A similar anticipative action can be performed with respect to measured disturbances v(k), namely v(k+i)=v(k) if the measured disturbance is not known in advance (e.g. is coming from a Simulink® block) or v(k+i) is obtained from the workspace. In the prediction, d(k+i) is instead obtained by setting nd(k+i)=0 in Figure 2-1 and Figure 2-2.
w
ui,j, wui,j, wyi,j, are nonnegative weights for the corresponding variable. The smaller w, the less important is the behavior of the corresponding variable to the overall performance index.
uj,min, uj,max,
uj,min,
uj,max, yj,min, yj,max are lower/upper bounds on the corresponding variables. In Equation 2-4, the constraints on u,
u, and y are relaxed by introducing the slack variable 
0. The weight 
on the slack variable
penalizes the violation of the constraints. The larger 
with respect to input and output weights, the more the constraint violation is penalized. The Equal Concern for the Relaxation (ECR) vectors Vumin,Vumax, V
umin, VDumax, Vymin, Vymax have nonnegative entries which represent the concern for relaxing the corresponding constraint; the larger V, the softer the constraint. V=0 means that the constraint is a hard one that cannot be violated. By default, all input constraints are hard (Vumin=Vumax=V
umin=V
umax=0) and all output constraints are soft (Vymin=Vymax=1). As hard output constraints may cause infeasibility of the optimization problem (for instance, because of unpredicted disturbances, model mismatch, or just because of numerical round off), a warning message is produced if Vymin, Vymax are smaller than a given small value and automatically adjusted at that value. By default,
|
(2-4) |
Note that also ECRs can be time varying.
Vector utarget(k+i) is a setpoint for the input vector. One typically uses utarget if the number of inputs is greater than the number of outputs, as a sort of lower-priority setpoint.
As mentioned earlier, only
u(k|k) is actually used to compute u(k). The remaining samples
u(k+i|k) are discarded, and a new optimization problem based on ym(k+1) is solved at the next sampling step k+1.
The algorithm implemented in the Model Predictive Control Toolbox™ software uses different procedures depending on the presence of constraints. If all the bounds are infinite, then the slack variable
is removed, and the problem in Equation 2-3 and Equation 2-4 is solved analytically. Otherwise a Quadratic Programming (QP) solver is used. The matrices associated with the quadratic optimization problem are described in QP Matrices.
Since output constraints are always soft, the QP problem is never infeasible. If for numerical reasons the QP problem becomes infeasible, the second sample from the previous optimal sequence is applied, i.e. u(k)=u(k-1)+
*u(k|k-1).
Alternative Cost Function
You have the option to use the following quadratic objective instead of the standard one (Equation 2-3):
|
(2-5) |
where Q is an ny by ny matrix, and
and Ru are nu by nu matrices, all positive semi-definite. Equation 2-5 allows non-zero off-diagonal weights but uses the same weights at each step in the prediction horizon.
Equation 2-3 and Equation 2-5 are equivalent when the weights
,
, and
are constant for all
, and when the matrices Q,
and Ru are diagonal with the squares of the weights
,
, and
respectively as their diagonal elements.
| Note When using the alternative cost function you must define the controller using MATLAB® commands. The MPC design tool does not provide this option. |
Remarks on the Constraint Formulation
The constraints listed in Equation 2-3 are bounds of various types. They are general in the sense that each bound can vary at each step in the prediction horizon. In addition, the linear model relating the plant inputs and outputs is a set of linear equality constraints and is included implicitly.
Quadratic programming allows general equalities and inequalities that are linear combinations of the decision variables. The current MPC Toolbox does not allow you to include such constraints explicitly in your controller design.
If you have a small number of such constraints, consider incorporating them as new variables in your model. For example, suppose you would like a linear combination of selected inputs and outputs to be kept less than or equal to a given constant value. You can define a new model output to represent the linear combination. If the combination involves manipulated variables, include a unit delay (to eliminate direct transfer from a manipulated variable to an output) or declare the combination to be an unmeasured output. Then define a bound on this output in your controller design.
If there is sufficient demand for generalized constraints, the feature may be included in a future toolbox release.
| Provide feedback about this page |
![]() | Prediction Model | State Estimation | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |