| Contents | Index |
Control System Toolbox software gives you several tools for designing PID controllers.
| Tool | When to use |
|---|---|
Use to design a SISO PID controller in the feed-forward path of single-loop, unity-feedback control configuration.
| |
| SISO Design Tool | Use to design a SISO PID controller in any other loop configuration. |
Use the PID Tuner GUI to interactively design a SISO PID controller in the feed-forward path of single-loop, unity-feedback control configuration.

The PID Tuner automatically designs a controller for your plant. You specify the controller type (P, I, PI, PD, PDF, PID, PIDF) and form (parallel or standard). You can analyze the design using a variety of response plots, and interactively adjust the design to meet your performance requirements.
To launch the PID Tuner, use the pidtool command:
pidtool(sys,type)
where sys is a linear model of the plant you want to control, and type is a string indicating the controller type to design.
Alternatively, enter
pidtool(sys,Cbase)
where Cbase is a baseline controller, allowing you to compare the performance of the designed controller to the performance of Cbase.
For more information about sys and Cbase, see the pidtool reference page.
The PID Tuner can tune up to seven types of controllers. To select the controller type, use one of these methods:
Provide the type argument to the launch command pidtool.
Provide a baseline controller Cbase to the launch command pidtool. The PID Tuner designs a controller of the same type as Cbase.
Use the Type menu to change controller types after launching the PID Tuner.
| type input to pidtool | Entry in Type menu | Controller Type | Continuous-time Controller Formula (parallel form) | Discrete-time Controller Formula (parallel form, ForwardEuler integrator formulas) |
|---|---|---|---|---|
| 'p' | P | Proportional only | Kp | Kp |
| 'i' | I | Integral only |
|
|
| 'pi' | PI | Proportional and integral |
|
|
| 'pd' | PD | Proportional and derivative |
|
|
| 'pdf' | Proportional and derivative with first-order filter on derivative term |
|
| |
| 'pid' | PID | Proportional, integral, and derivative |
|
|
| 'pidf' | PIDF | Proportional, integral, and derivative with first-order filter on derivative term |
|
|
If sys is a discrete-time model with sampling time Ts, the PID Tuner designs a discrete-time pid controller using the ForwardEuler discrete integrator formula. To design a controller that has different discrete integrator formulas, use one of the following methods:
Provide a discrete-time baseline controller Cbase to the launch command pidtool. The PID Tuner designs a controller that has the same discrete integrator formulas as Cbase.
After launching the PID Tuner, click the
button to open the PID
Tuner Settings dialog box. Select discrete integrator formulas
from the Integral Formula and Derivative
Formula menus.
For more information about discrete integrator formulas, see the pid and pidstd reference pages.
When you use the type input to launch the PID Tuner, the PID Tuner designs a controller in parallel form. To design a controller in standard form, use one of the following methods:
Provide a standard-form baseline controller Cbase to the launch command pidtool. The PID Tuner designs a controller of the same form as Cbase.
Use the Form menu to change controller form after launching the PID Tuner.
For more information about parallel and standard controller forms, see the pid and pidstd reference pages.
Select response plots from the Response menu to analyze the controller's performance. The PID Tuner computes the system responses assuming the following architecture:

The following table summarizes the available response plots.
| Response | Plotted System | Description |
|---|---|---|
| Reference tracking |
| Shows the closed-loop system response to a change in setpoint. Use when your design specifications include setpoint tracking. |
| Controller effort |
| Shows the closed-loop controller output response to a change in setpoint. Use when your design is limited by practical constraints, such as controller saturation. |
| Input disturbance Rejection |
| Shows the closed-loop system response to load disturbance (a disturbance at the plant input). Use when your design specifications include input disturbance rejection. |
| Output disturbance Rejection |
| Shows the closed-loop system response to measurement noise. |
| Open-loop | C*sys | Shows response of the open-loop controller-plant system. Use
for frequency-domain design. Use when your design specifications include robustness criteria such as open-loop gain margin and phase margin. |
| Plant | sys | Shows the plant response. Use to examine plant dynamics. |
Choose time-domain (Step) or frequency-domain (Bode) responses from the Plot menu.
If you provide Cbase, check Show baseline to display the response of the baseline controller.
In this example, you use the PID Tuner to design a controller for the plant:
![]()
The design requirements are for the closed loop system to track a reference input with a rise time less than 1.5 s, and settling time less than 6 s.
Launch the PID Tuner to design a PI controller for a first pass design.
sys = zpk([],[-1 -1 -1],1); % create the plant model pidtool(sys,'pi')
Upon launch, the PID Tuner displays the closed-loop step response of the system with a PI controller designed for a balance between performance (response time) and robustness (stability margins).

Examine the reference tracking rise time and settling time.
Right-click on the plot and select Characteristics > Rise Time to mark the rise time as a blue dot on the plot. Select Characteristics > Settling Time to mark the settling time. To see tool-tips with numerical values, click each of the blue dots.

The PID Tuner default PI controller provides a rise time of 2.35 s and settling time of 10.7 s. Both results are slower than the design requirements.
Use the Response time slider to try to improve the loop performance.
Slide the slider to the right to make the loop faster. The response plot automatically updates with the new design.
Moving the slider far enough to meet the rise time requirement of less than 1.5 s, however, results in unacceptably long settling time. There is also more oscillation. To achieve the faster response speed, the algorithm must sacrifice stability.

Change the controller type to improve the response.
Adding derivative action to the controller gives the PID Tuner more freedom to achieve adequate phase margin with the desired response speed.
Select PIDF from the Type menu. The PID Tuner designs a new PIDF controller. (See PID Controller Type for more information about available controller types.)

The rise time and settling time now meet the design requirements.
You can use the Response time slider to make
further adjustments to the response. To revert to the default automated
tuning result, click the
button.
Analyze other system responses, if appropriate.
To analyze other system responses, use the Response menu to choose a response plot and the Plot menu to choose time-domain (Step) or frequency-domain (Bode) responses.
For example, to observe the closed-loop system response to disturbance at the plant input, select Input disturbance rejection from the Response menu.

See Analyzing Your Design Using Response Plots for more information about available response plots.
Export your controller design to the MATLAB workspace.
To export your final controller design to the MATLAB workspace,
click
. The PID Tuner GUI exports
the controller as a
For more examples of controller design using the PID Tuner, see the Control System Toolbox demo, Designing PID for Disturbance Rejection with PID Tuner
To design PID Controllers at the command line, use the pidtune command. For more information and examples, see:
pidtune reference page
Control System Toolbox demo: Designing Cascade Control System with PI Controllers
![]() | Designing Compensators | SISO Design Tool | ![]() |

Learn more about resources for designing, testing, and implementing control systems.
Get free kit| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |