PID Controller Tuning

Automatic and interactive tuning of PID gains in Simulink®

Use automatic PID tuning to tune single-loop control systems containing PID Controller or PID Controller 2DOF Simulink blocks. To decide whether automatic PID tuning is right for your application, see Choosing a Control Design Approach.

Graphical Tools

PID Tuner Tune PID controllers


PID Controller Simulate continuous- or discrete-time PID controllers
PID Controller (2 DOF) Simulate continuous- or discrete-time two-degree-of-freedom PID controllers

Examples and How To

PID Tuning Basics

PID Controller Tuning in Simulink

You can tune the gains of PID Controller blocks to achieve a robust design with the desired response time using PID Tuner.

Open PID Tuner

Open the PID Tuner app to tune PID Controller or PID Controller (2DOF) blocks.

Analyze Design in PID Tuner

To determine whether your PID controller meets your requirements, you can analyze the system response using the PID Tuner response plots.

Verify the PID Design in Your Simulink Model

After tuning a PID Controller using a linear model of your plant, verify that the tuned controller meets your design requirements when applied to your nonlinear Simulink model.

Tune PID Controller to Favor Reference Tracking or Disturbance Rejection

Tune a PID controller to reduce overshoot in reference tracking or to improve rejection of a disturbance at the plant input.

Tune PID Controller Within Model Reference

When you open PID Tuner from a controller block in a model that is referenced in one or more open models, you must specify which open model is the top-level model for linearization and tuning.

Alternative Plant Models

Tune at a Different Operating Point

By default, PID Tuner linearizes your plant and designs a controller at the operating point specified by the initial conditions in your Simulink model. In some cases, this operating point can differ from the operating point for which you want to design a controller.

Import Measured Response Data for Plant Estimation

If you have System Identification Toolbox™ software, you can import measured time-domain response data into PID Tuner. You can then estimate a plant model for this response data.

Interactively Estimate Plant from Measured or Simulated Response Data

If you have System Identification Toolbox software, estimate the parameters of a linear plant model based on time-domain response data using PID Tuner. You can then tune a PID controller for the resulting estimated model.

Design a PID Controller Using Simulated I/O Data

This example shows how to tune a PID controller for plants that cannot be linearized.

Designing PID Controller in Simulink with Estimated Frequency Response

When your plant cannot be linearized, you can estimate a plant model using frequency response estimation and import the plant model into PID Tuner.

Gain-Scheduled PID Control

Designing a Family of PID Controllers for Multiple Operating Points

If your nonlinear Simulink model operates over a wide range of operating conditions, you can design an array of PID controllers for multiple model operating points.

Implement Gain-Scheduled PID Controllers

To implement gain-scheduled control using a family of PID controllers, create a lookup table that associates each plant operating point with the corresponding PID gains.

Two-Degree-of-Freedom PID Controllers

Design Two-Degree-of-Freedom PID Controllers

Tune PID Controller (2DOF) blocks to achieve both good setpoint tracking and good disturbance rejection.

Specify PI-D and I-PD Controllers

PI-D and I-PD controllers are used to mitigate the influence of changes in the reference signal on the control signal. These controllers are variants of the 2DOF PID controller.


Automatic PID Tuning

Choosing a Control Design Approach

Simulink Control Design™ provides several approaches to tuning Simulink blocks, such as Transfer Fcn and PID Controller blocks.

Introduction to Automatic PID Tuning in Simulink

You can use PID Tuner to tune PID gains automatically in a Simulink model containing a PID Controller or PID Controller (2DOF) block.

What Plant Does PID Tuner See?

PID Tuner considers as the plant all blocks in the loop between the PID Controller block output and input.

PID Tuning Algorithm

MathWorks® algorithm for tuning PID controllers tunes the PID gains to achieve a good balance between performance and robustness.

Identifying Plant Models

System Identification for PID Control

System identification is the process of estimating a dynamic representation of the system you want to control, based on the system response to a known excitation.

Input/Output Data for Identification

Identification of a plant model for PID tuning requires a single-input, single-output data set.

Choosing Identified Plant Structure

In PID Tuner you can represent identified plant dynamics as either process models or state-space models.

Preprocess Data

Perform preprocessing operations such as removing offsets and filtering the data before you use it.


Plant Cannot Be Linearized or Linearizes to Zero

Some Simulink blocks, such as those with sharp discontinuities, can produce poor linearization results. For example, when your model operates in a region away from the point of discontinuity, the linearization of the block is zero.

Cannot Find a Good Design in PID Tuner

If you cannot find a good design using PID Tuner, try a different PID controller type. If no PID controller is satisfactory, consider designing a more complex controller.

Simulated Response Does Not Match the PID Tuner Response

When you run your Simulink model using the PID gains computed by PID Tuner, the simulation output can differ from the PID Tuner response plot.

Cannot Find an Acceptable PID Design in the Simulated Model

When you run your Simulink model using the PID gains computed by PID Tuner, the simulation output may not meet your design requirements.

Controller Performance Deteriorates When Switching Time Domains

If controller performance deteriorates when you discretize a tuned continuous-time PID controller, consider tuning a discrete-time controller directly.

When Tuning the PID Controller, the D Gain Has a Different Sign from the I Gain

When you use PID Tuner to design a controller, the resulting derivative gain D can have a different sign from the integral gain I. PID Tuner always returns a stable controller, even if one or more gains are negative.

Was this topic helpful?