www.gusucode.com > mpc 案例源码 matlab代码程序 > mpc/SpecifyConstraintsPenaltyWeightAtLastPredictHorizStepExample.m
%% Specify Constraints and Penalty Weights at Last Prediction Horizon Step %% % 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 |8|. MPCobj.PredictionHorizon = 8; %% % Define the following penalty weights and constraints: %% % * Diagonal penalty weights of |1| and |10| on the first two output % variables % * 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('Weight',[1,10,0],'Min',[0,-Inf,-1],'Max',[Inf,2,Inf]); U = struct('Min',[1,-Inf]); %% % Specify the constraints and penalty weights at the last step of the % prediction horizon. setterminal(MPCobj,Y,U)