%% Specify Custom Constraints for MPC Controller with Measured Disturbances
% Create a third-order plant model with two manipulated variables, two measured disturbances, and two measured outputs.

plant = rss(3,2,4);
plant.D = 0;
plant = setmpcsignals(plant,'mv',[1 2],'md',[3 4]);

%
% Create an MPC controller for this plant.

MPCobj = mpc(plant,0.1);

% Assume that you have three soft constraints.
% \begin{array}{l}
% {u_1} + {u_2} \le 5\\
% {y_1} + {v_1} \le 10\\
% {y_2} + {v_2} \le 12
% \end{array}
%
% Specify the constraint matrices.

E = [1 1; 0 0; 0 0];
F = [0 0; 1 0; 0 1];
G = [5;10;12];
S = [0 0; 1 0; 0 1];

%
% Set the constraints in the MPC controller using the default value for V.

setconstraint(MPCobj,E,F,G,[],S)

% Copyright 2015 The MathWorks, Inc.