Main Content


Size and order of MPC Controller


Use the Model Predictive Control Toolbox™ size function to return size and order of an MPC controller (see mpc for background).

To return the dimensions of an generic array or table instead, see size.


mpcSize = size(MPCobj) returns a row vector specifying the number of manipulated variables and the number of measured plant outputs associated with MPCobj.


signalSize = size(MPCobj,SignalType) returns the number of the element of the specified signal type associated with MPCobj.


size(___) displays the corresponding size information for any of the previous syntaxes.


collapse all

Create a plant, a corresponding MPC object, and get the size of the MPC signals.

mpcverbosity off;                           % turn off mpc messages
plant = rss(5,2,3);plant.D=0;               % random state space
mpcobj=mpc(plant,1);                        % create mpc object (1 second sampling time)

mpcSize = size(mpcobj)                      % size of the MPC controller
mpcSize =
     3     2

nMV = size(mpcobj,'MV')                     % size of manipulated variables vector 
nMV =
nMO = size(mpcobj,"MO")                     % size of measured output vector 
nMO =
nMD = size(mpcobj,'md')                     % size of measured (input) disturbance vector 
nMD =

size(mpcobj)                                % size of MPC controller, printout
MPC controller with 2 measured output(s), 0 unmeasured output(s),
3 manipulated input(s), 0 measured disturbance(s), 0 unmeasured disturbance(s)

Input Arguments

collapse all

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

You can specify SignalType as one of the following (in lower or upper case):

  • 'uo' — Unmeasured controlled outputs

  • 'md' — Measured disturbances

  • 'ud' — Unmeasured disturbances

  • 'mv' — Manipulated variables

  • 'mo' — Measured controlled outputs

Example: "MV"

Output Arguments

collapse all

This row vector contains the two positive integers, nu and nym, where nu is the number of manipulated variables (controlled plant inputs) and nym is the number of measured plant outputs.

This positive integer is the number of elements of the specified signal type associated with MPCobj

See Also


Introduced before R2006a