Documentation 
Model Predictive Control custom constraint definitions
[E,F,G,V,S]
= getconstraint(mpcobj)
[E,F,G,V,S] = getconstraint(mpcobj) returns the custom constraints previously defined for the mpc object, mpcobj. The constraints are in the general form
$$Eu(k+j)+Fy(k+j)+Sv(k+j)\le G+\epsilon V$$  (11) 
where:
j = 0,...,p.
p — MPC prediction horizon.
k — current time index.
u — column vector of manipulated variables.
y — column vector of all plant output variables.
v — column vector of measured disturbance variables.
ε — scalar slack variable used for constraint softening.
E, F, G, V and S — constant matrices.
getconstraint calculates the last constraint at time k+p assuming that u(k+pk) = u(k+p1k). This is because u(k+pk) is not optimized by the model predictive controller.
E 
Constant used in custom constraints as defined in Equation 11. [] if mpcobj contains no custom constraints. E is an n_{c}byn_{u} matrix, where n_{c} is the number of custom constraints and n_{u} is the number of manipulated variables. 
F 
Constant used in custom constraints as defined in Equation 11. [] if mpcobj contains no custom constraints. F is an n_{c}byn_{y} matrix, where n_{c} is the number of custom constraints and n_{y} is the number of output variables (measured and unmeasured). 
G 
Constant used in custom constraints as defined in Equation 11. [] if mpcobj contains no custom constraints. G is an n_{c}by1 vector, where n_{c} is the number of custom constraints. 
V 
Constant used in custom constraints as defined in Equation 11. [] if mpcobj contains no custom constraints. V is an n_{c}by1 vector, where n_{c} is the number of custom constraints. If

S 
Constant used in custom constraints as defined in Equation 11. [] if mpcobj contains no custom constraints or there are no measured disturbances in the custom constraints. S is an n_{c}byn_{md} matrix, where n_{c} is the number of custom constraints and n_{md} is the number of measured disturbance inputs. 
Obtain the constraints associated with an MPC controller.
Create an mpc object with 2 manipulated variables and 2 measured outputs.
p = rss(3,2,3); p.D = 0; p = setmpcsignals(p,'mv',[1 2],'md',3); c = mpc(p,0.1);
Assume that you have two soft constraints.
$$\begin{array}{l}{u}_{1}+{u}_{2}\le 5\\ {y}_{2}+v\le 10\end{array}$$
Set the constraints for the mpc object.
E = [1 1; 0 0]; F = [0 0;0 1]; G = [5;10]; V = [1;1]; S = [0;1]; setconstraint(c,E,F,G,V,S);
Obtain the constraints for c.
[E F G V S] = getconstraint(c) E = 1 1 0 0 F = 0 0 0 1 G = 5 10 V = 1 1 S = 0 1