www.gusucode.com > mpc 案例源码 matlab代码程序 > mpc/SpecifyCustomHardConstraintsForAnMPCControllerExample.m
%% Specify Custom Hard Constraints for MPC Controller %% % Create a third-order plant model with two manipulated variables and two % measured outputs. plant = rss(3,2,2); plant.D = 0; %% % Create an MPC controller for this plant. MPCobj = mpc(plant,0.1); %% % Assume that you have two hard constraints. %% % % $$\begin{array}{l} % {u_1} + {u_2} \le 5\\ % {y_1} + y_2 \le 10 % \end{array}$$ % %% % Specify the constraint matrices. E = [1 1; 0 0]; F = [0 0; 1 1]; G = [5;10]; %% % Specify the constraints as hard by setting |V| to zero for % both constraints. V = [0;0]; %% % Set the constraints in the MPC controller. setconstraint(MPCobj,E,F,G,V)