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
returns the number of the element of the specified signal type associated with
signalSize = size(
size(___) displays the corresponding size information
for any of the previous syntaxes.
Get size of MPC controller
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 = 3 nMO = size(mpcobj,"MO") % size of measured output vector nMO = 2 nMD = size(mpcobj,'md') % size of measured (input) disturbance vector nMD = 0 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)
mpcobj — Model predictive controller
mpc object |
Model predictive controller, specified as one of the following:
mpcobject — Implicit MPC controller
explicitMPCobject — Explicit MPC controller created using
SignalType — Type of the MPC signal
character array | string
You can specify
SignalType as one of the following (in lower or
'uo'— Unmeasured controlled outputs
'md'— Measured disturbances
'ud'— Unmeasured disturbances
'mv'— Manipulated variables
'mo'— Measured controlled outputs
mpcSize — Size of the MPC controller
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.
signalSize — Size of the MPC signal
This positive integer is the number of elements of the specified signal type
Introduced before R2006a