Specifications
4 Designing Controllers Using the Command Line
4-2
Design Controller at the Command Line
In this section...
“Create a Controller Object” on page 4-2
“View and Alter Controller Properties” on page 4-3
“Review Controller Design” on page 4-5
“Perform Linear Simulations” on page 4-6
“Save Calculated Results” on page 4-8
“Design Controller Using the Design Tool” on page 3-2 shows how to use the Model
Predictive Control Toolbox design tool to create a controller and test it. You might prefer
to use functions instead. They allow access to options not available in the design tool, as
well as automation of repetitive tasks using scripts and customized plotting.
Create a Controller Object
This topic uses the CSTR model described in “CSTR Model” on page 2-19 as an example.
You must have the linear plant model CSTR in the base workspace before beginning this
tutorial.
Use the mpc function to create a controller. For example, type
Ts = 1;
MPCobj = mpc(CSTR,Ts);
to create one based on the CSTR model with a control interval of 1 time unit and all other
parameters at their default values.
Note MPCobj is an MPC object. It contains a complete controller definition for use with
Model Predictive Control Toolbox software.
To display the controller's properties in the Command Window, type
display(MPCobj)
or type the object's name without a trailing semicolon.