Documentation

## Proportional-Integral-Derivative (PID) Controllers

You can represent PID controllers using the specialized model objects pid and pidstd. This topic describes the representation of PID controllers in MATLAB®. For information about automatic PID controller tuning, see PID Controller Tuning.

### Continuous-Time PID Controller Representations

You can represent continuous-time Proportional-Integral-Derivative (PID) controllers in either parallel or standard form. The two forms differ in the parameters used to express the proportional, integral, and derivative actions and the filter on the derivative term, as shown in the following table.

FormFormula
Parallel (pid object)

$C={K}_{p}+\frac{{K}_{i}}{s}+\frac{{K}_{d}s}{{T}_{f}s+1},$

where:

• Kp = proportional gain

• Ki = integrator gain

• Kd = derivative gain

• Tf = derivative filter time

Standard (pidstd object)

$C={K}_{p}\left(1+\frac{1}{{T}_{i}s}+\frac{{T}_{d}s}{\frac{{T}_{d}}{N}s+1}\right),$

where:

• Kp = proportional gain

• Ti = integrator time

• Td = derivative time

• N = derivative filter divisor

Use a controller form that is convenient for your application. For example, if you want to express the integrator and derivative actions in terms of time constants, use standard form.

For information on representing PID Controllers in discrete time, see Discrete-Time Proportional-Integral-Derivative (PID) Controllers

### Create Continuous-Time Parallel-Form PID Controller

This example shows how to create a continuous-time Proportional-Integral-Derivative (PID) controller in parallel form using pid.

Create the following parallel-form PID controller: $C=29.5+\frac{26.2}{s}-\frac{4.3s}{0.06s+1}.$

Kp = 29.5;
Ki = 26.2;
Kd = 4.3;
Tf = 0.06;
C = pid(Kp,Ki,Kd,Tf)

C is a pid model object, which is a data container for representing parallel-form PID controllers. For more examples of how to create PID controllers, see the pid reference page.

### Create Continuous-Time Standard-Form PID Controller

This example shows how to create a continuous-time Proportional-Integral-Derivative (PID) controller in standard form using pidstd.

Create the following standard-form PID controller: $C=29.5\left(1+\frac{1}{1.13s}+\frac{0.15s}{\frac{0.15}{2.3}s+1}\right).$

Kp = 29.5;
Ti = 1.13;
Td = 0.15;
N = 2.3;
C = pidstd(Kp,Ti,Td,N)

C is a pidstd model object, which is a data container for representing standard-form PID controllers. For more examples of how to create standard-form PID controllers, see the pidstd reference page.