%% Discrete-Time 2-DOF PI Controller
% Create a discrete-time 2-DOF PI controller using the trapezoidal discretization formula. Specify the formula using Name,Value syntax.

Kp = 5;
Ki = 2.4;
Kd = 0;    
Tf = 0; 
b = 0.5;   
c = 0;      
Ts = 0.1;
C2 = pid2(Kp,Ki,Kd,Tf,b,c,Ts,'IFormula','Trapezoidal')

% Setting Kd = 0 specifies a PI controller with no derivative term. As the display shows, the values of Tf and c are not used in this controller. The display also shows that the trapezoidal formula is used for the integrator.
% Copyright 2015 The MathWorks, Inc.