%% Convert 2-DOF PID Controller from Parallel to Standard Form
% Convert a parallel-form pid2 controller to standard form.
% Parallel PID form expresses the controller actions in terms of proportional, integral, and derivative gains Kp, Ki, and Kd, and filter time constant Tf. You can convert a parallel-form pid2 controller to standard form using the pidstd2 command, provided that both of the following are true:
% The pid2 controller can be expressed in valid standard form.
% The gains Kp, Ki, and Kd of the pid2 controller all have the same sign.
% For example, consider the following parallel-form controller.

Kp = 2;
Ki = 3;
Kd = 4;
Tf = 2;
b = 0.1;
c = 0.5;
C2_par = pid2(Kp,Ki,Kd,Tf,b,c)

%
% Convert this controller to parallel form using pidstd2.

C2_std = pidstd2(C2_par)

%
% The display confirms the new standard form. A response plot confirms that the two forms are equivalent.

bodeplot(C2_par,'b-',C2_std,'r--')
legend('Parallel','Standard','Location','Southeast')

% Copyright 2015 The MathWorks, Inc.