pidtune
PID tuning algorithm for linear plant model
Syntax
C = pidtune(sys,type)
C = pidtune(sys,C0)
C = pidtune(sys,type,wc)
C =
pidtune(sys,C0,wc)
C = pidtune(sys,...,opts)
[C,info]
= pidtune(...)
Description
designs a PID controller of type C
= pidtune(sys
,type
)type
for the plant
sys
. If type
specifies a onedegreeoffreedom
(1DOF) PID controller, then the controller is designed for the unit feedback loop as
illustrated:
If type
specifies a twodegreeoffreedom (2DOF) PID controller,
then pidtune
designs a 2DOF controller as in the feedback loop of this
illustration:
pidtune
tunes the parameters of the PID controller
C
to balance performance (response time) and robustness (stability
margins).
designs a controller of the same type and form as the controller C
= pidtune(sys
,C0
)C0
. If
sys
and C0
are discretetime models,
C
has the same discrete integrator formulas as
C0
.
and
C
= pidtune(sys
,type
,wc
)
specify a target value C
=
pidtune(sys
,C0
,wc
)wc
for the first 0 dB gain crossover frequency of
the openloop response.
uses additional tuning options, such as the target phase margin. Use C
= pidtune(sys
,...,opts
)pidtuneOptions
to specify the option set opts
.
[
returns the data structure C
,info
]
= pidtune(...)info
, which contains information about
closedloop stability, the selected openloop gain crossover frequency, and the actual phase
margin.
Input Arguments

Singleinput, singleoutput dynamic system
model of the plant for controller design.
If the plant has unstable poles, and
you must use 

Controller type of the controller to design, specified as a character vector. The
term controller type refers to which terms are present in the
controller action. For example, a PI controller has only a proportional and an integral
term, while a PIDF controller contains proportional, integrator, and filtered derivative
terms. 1DOF Controllers
2DOF Controllers
For more information about 2DOF PID controllers generally, see TwoDegreeofFreedom PID Controllers. 2DOF Controllers with Fixed Setpoint Weights
For more detailed information about fixedsetpointweight 2DOF PID controllers, see PID Controller Types for Tuning. Controller FormWhen you use the If For more information about PID controller forms and formulas, see:


PID controller setting properties of the designed controller, specified as a


Target value for the 0 dB gain crossover frequency of the tuned openloop response.
Specify Increase 

Option set specifying additional tuning options for the 
Output Arguments

Controller designed for Controller form:
Controller type:
In either case, however, where the algorithm can achieve adequate performance and
robustness using a lowerorder controller than specified with Time domain:
If you specify 

Data structure containing information about performance and robustness of the tuned
PID loop. The fields of
If 
Examples
Tips
By default,
pidtune
with thetype
input returns apid
controller in parallel form. To design a controller in standard form, use apidstd
controller as input argumentC0
. For more information about parallel and standard controller forms, see thepid
andpidstd
reference pages.For interactive PID tuning in the Live Editor, see the Tune PID Controller Live Editor task. This task lets you interactively design a PID controller and automatically generates MATLAB^{®} code for your live script.
Algorithms
For information about the MathWorks^{®} PID tuning algorithm, see PID Tuning Algorithm.
Alternatives
For interactive PID tuning in the Live Editor, see the Tune PID Controller Live Editor task. This task lets you interactively design a PID controller and automatically generates MATLAB code for your live script. For an example, see PID Controller Design in the Live Editor
For interactive PID tuning in a standalone app, use PID Tuner. See PID Controller Design for Fast Reference Tracking for an example of designing a controller using the app.
References
Åström, K. J. and Hägglund, T. Advanced PID Control, Research Triangle Park, NC: Instrumentation, Systems, and Automation Society, 2006.