2DOF PID controller design
Version 1.0.2 (52.8 KB) by
Vadim Alexandrov
The function computes 2DOF PID controller coefficients of formula u = Kp*(b*r-y) + Ki/s*(r-y) + Kd*s/(Tf*s+1)*(c*r-y) for 2d order plant tf.
The function
[pid_coefficients, results_info] = pid2dof_pp_design(plant_tf, desired_tf, N_max, lambda_min, lambda_max, zeta_min, S_max, gain_sign_check)
computes 2DOF PID controller coefficients
of formula
,
where r is reference, y is system output and u is control value.
Execution time of the procedure can be a minute.
Input Arguments:
- plant_tf - strictly proper second order transfer function of plant model created by tf Matlab function (first order with InputDelay is also allowed);
- desired_tf - strictly proper first or second order desired transfer function of closed loop system: if plant_tf is first order with InputDelay, then first order or first order with the same InputDelay; if plant_tf numerator is a gain only, then desired_tf numerator must be a gain only too; if plant_tf has a zero, then desired_tf can be first order or second order with the same zero. Default: desired_tf is constructed based on defined plant_tf.
- N_max - real and finite positive value, maximum allowed value for noise sensitivity function
norm. This is the main tunable parameter that value should be verified by system simulation with noise and input/output boundaries. Default: 10/plant_gain.
- lambda_min - real and finite positive value, minimun absolute value for poles region of the closed loop system (the exclusion of poles defined in desired_tf). Default: lambda_min is constructed based on defined plant_tf.
- lambda_max - real and finite positive value, maximum absolute value for poles region of the closed loop system (the exclusion of poles defined in desired_tf). Default: log10(lambda_max) = log10(lambda_min) + 2.
- zeta_min - real and finite positive value, minimun value for damping ratio of the closed loop system. Default: 0.7.
- S_max - real and finite value >=1, maximum allowed value for sensitivity function
norm as constraint for stability margins. Default: 2.0.
- gain_sign_check - logical value, if true then the resulting controller must have nonnegative coefficients; if false then this constraint is not taken into account. Default: true.
Output Arguments:
- pid_coefficients - stucture with resulting PID coefficients
- results_info - stucture with control design data: defined or default values of input parameters are results_info.lambda_min, ..., results_info.desired_tf; results_info.S_data, results_info.N_data, results_info.gain_sign_data are tables of obtained constrains value for each grid points of the first stage; polynomials of resulting controller in form
are presented; searched values for system characteristic polynomial
are saved;
norms of resulting sensitivity function and noise and disturbance sensitivity functions are reported.
You can set only the plant transfer function as input arguments, while the other arguments will be defined by default. Their values will be available in results_info. Then you can run the function again, specifying input arguments values that differ from the default ones.
If the function result is message Solution for defined constraints is not found, then another version of the input arguments should be defined.
Control design via pole placement optimization under robustness constraints is described in
Alexandrov V., 2021. Pole placement optimization for SISO control system. Automation and Remote Control, No.82(6), pp. 1013–1029, doi:10.1134/S0005117921060047.
The procedure pid2dof_pp_design implements this approach for the case of PID controller design in 2dof version.
Cite As
Vadim Alexandrov (2025). 2DOF PID controller design (https://www.mathworks.com/matlabcentral/fileexchange/181779), MATLAB Central File Exchange. Retrieved August 12, 2025.
MATLAB Release Compatibility
Created with
R2020a
Compatible with any release
Platform Compatibility
Windows macOS LinuxTags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
