Main Content


Generate MPC controller using generalized predictive controller (GPC) settings


mpcobj = gpc2mpc(plant) generates a single-input single-output MPC controller with default GPC settings and sample time of the specified plant, plant. The GPC is a nonminimal state-space representation described in References. plant is a discrete-time LTI model with sample time greater than 0.


gpcOptions = gpc2mpc creates a structure gpcOptions containing default values of GPC settings.


mpcobj = gpc2mpc(plant,gpcOptions) generates an MPC controller using the GPC settings in gpcOptions.


collapse all

% Specify the plant described in Example 1.8  of 
% References.
G = tf(9.8*[1 -0.5 6.3],conv([1 0.6565],[1 -0.2366 0.1493]));

% Discretize the plant with sample time of 0.6 seconds.
Ts = 0.6;
Gd = c2d(G, Ts);

% Create a GPC settings structure.
GPCoptions = gpc2mpc;

% Specify the GPC settings described in example 4.11 of 
% References.
% Hu
GPCoptions.NU = 2; 
% Hp
GPCoptions.N2 = 5; 
% R
GPCoptions.Lam = 0; 
GPCoptions.T = [1 -0.8];

% Convert GPC to an MPC controller.
mpc = gpc2mpc(Gd, GPCoptions);

% Simulate for 50 steps with unmeasured disturbance between 
% steps 26 and 28, and reference signal of 0. 
SimOptions = mpcsimopt(mpc);
SimOptions.UnmeasuredDisturbance = [zeros(25,1); ...
-0.1*ones(3,1); 0];
sim(mpc, 50, 0, SimOptions);

Input Arguments

collapse all

Single-output LTI model with sampling time greater than 0, and only one manipulated variable input.

Example: zpk([],-1,1)

GPC settings, specified as a structure with the following fields.


Starting interval in prediction horizon, specified as a positive integer.

Default: 1

N2Last interval in prediction horizon, specified as a positive integer greater than N1.Default: 10

Control horizon, specified as a positive integer less than the prediction horizon.

Default: 1


Penalty weight on changes in manipulated variable, specified as a positive integer greater than or equal to 0.

Default: 0


Numerator of the GPC disturbance model, specified as a row vector of polynomial coefficients whose roots lie within the unit circle.

Default: [1].


Index of the manipulated variable for multi-input plants, specified as a positive integer.

Default: 1

Output Arguments

collapse all

Model predictive controller, specified as an MPC controller object. To create an MPC controller, use mpc.


  • For plants with multiple inputs, only one input is the manipulated variable, and the remaining inputs are measured disturbances in feedforward compensation. The plant output is the measured output of the MPC controller.

  • Use the MPC controller with Model Predictive Control Toolbox™ software for simulation and analysis of the closed-loop performance.


[1] Maciejowski, J. M. Predictive Control with Constraints, Pearson Education Ltd., 2002, pp. 133–142.

Version History

Introduced in R2010a