www.gusucode.com > mpc 案例源码 matlab代码程序 > mpc/SpecifyTerminalConstraintsForFinalPredictionHorizonRangeExample.m

    %% Specify Terminal Constraints For Final Prediction Horizon Range
%% 
% Create an MPC controller for a plant with three output variables and two
% manipulated variables.
plant = rss(3,3,2);
plant.D = 0;
MPCobj = mpc(plant,0.1);

%%
% Specify a prediction horizon of |10|.
MPCobj.PredictionHorizon = 10;

%%
% Define the following terminal constraints:
%%
% * Lower bounds of |0| and |-1| on the first and third outputs respectively
% * Upper bound of |2| on the second output
% * Lower bound of |1| on the first manipulated variable
Y = struct('Min',[0,-Inf,-1],'Max',[Inf,2,Inf]);
U = struct('Min',[1,-Inf]);

%%
% Specify the constraints beginning at step |5| and ending at the last step 
% of the prediction horizon.
setterminal(MPCobj,Y,U,5)