This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Generate MPC controller using generalized predictive controller (GPC) settings


mpc = gpc2mpc(plant)
gpcOptions = gpc2mpc
mpc = gpc2mpc(plant,gpcOptions)


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

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

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

Input Arguments


Discrete-time LTI model with sampling time greater than 0.


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

N1Starting 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.
NUControl horizon, specified as a positive integer less than the prediction horizon.
Default: 1.
LamPenalty weight on changes in manipulated variable, specified as a positive integer greater than or equal to 0.
Default: 0.
TNumerator of the GPC disturbance model, specified as a row vector of polynomial coefficients whose roots lie within the unit circle.
Default: [1].
MVindexIndex of the manipulated variable for multi-input plants, specified as a positive integer.
Default: 1.


Design an MPC controller using GPC settings:

% Specify the plant described in Example 1.8  of 
% [1].
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 
% [1].
% 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);

More About

collapse all


  • 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.

Introduced in R2010a

Was this topic helpful?