plot
Plot responses generated by MPC simulations
Syntax
Description
Use the Model Predictive Control Toolbox™
plot
function to plot responses generated by MPC
simulations.
To create 2-D line plots of data points instead, see plot
.
Examples
Plot Responses from MPC Simulation
Create a plant, a corresponding MPC object, and convert it to zero/pole/gain form.
mpcverbosity off; % turn off mpc messaging plant=tf(1,[1 -1 1],0.2); % create plant (0.2 seconds sampling time) mpcobj=mpc(plant,0.2); % create mpc object (0.2 second sampling time) [y,t,u,xp]=sim(mpcobj,10,1); % simulate closed loop for 10 steps plot(mpcobj,t,y,ones(size(y)),u); % plot response % You can plot other data. The signal type definitions and labels are contained in mpcobj plot(mpcobj,1:10,rand(10,1),zeros(10,1),sin(1:10)'); % random response
Input Arguments
mpcobj
— Model predictive controller
mpc
object
Model predictive controller, specified as an MPC controller
object. To create an MPC controller, use mpc
.
t
— Time sequence
double
vector
Time sequence, specified as an Nt
-by-1 array, where
Nt
is the number of simulation steps.
Example: 1:10
y
— Sequence of plant outputs values
double
array
Sequence of plant outputs values, specified as an array of output responses of size
Nt
-by-Ny
, where Ny
is the
number of measured outputs of the plant.
Example: rand(10,1)
r
— Sequence of reference values
double
array
Sequence of reference values for the plant output. It is an array of setpoints and
has the same size as y
.
Example: ones(10,1)
u
— Sequence of manipulated variables
double
array
Sequence of manipulated variables, specified as an array of manipulated variable
inputs of size Nt
-by-Nu
, where
Nu
is the number of manipulated variables.
Example: sin(1:10)'
v
— Sequence of measured disturbances inputs
[]
(default) | double
array
Sequence of measured disturbances input, specified as a matrix of size
Nt
-by-Nv
, where Nv
is the
number of measured disturbance inputs.
Example: zeros(10,1)
d
— Sequence of unmeasured disturbances inputs
[]
(default) | double
array
Sequence of unmeasured disturbances inputs, specified as an array of size
Nt
-by-Nd
, where Nd
is the
number of unmeasured disturbances inputs.
Example: zeros(10,1)
Version History
Introduced before R2006a
See Also
Functions
Objects
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)