%% Create MPC Code Generation Data Structures
% Create a plant model, and define the MPC signal types.

plant = rss(3,2,2);
plant.D = 0;
plant = setmpcsignals(plant,'mv',1,'ud',2,'mo',1,'uo',2);

%
% Create an MPC controller.

mpcObj = mpc(plant,0.1);

%
% Configure your controller parameters. For example, define bounds for the manipulated variable.

mpcObj.ManipulatedVariables.Min = -1;
mpcObj.ManipulatedVariables.Max = 1;

%
% Create code generation data structures.

[configData,stateData,onlineData] = getCodeGenerationData(mpcObj);

% Copyright 2012 The MathWorks, Inc.