%% Extract Standard-Form Coefficients from 2-DOF PI Controller Array
% Typically, you obtain an array of controllers by using pidtune on an array of plant models. For this example, create an 2-by-3 array of standard-form 2-DOF PI controllers with random values of Kp, Ti, and b.

rng('default');
C2 = pidstd2(rand(2,3),rand(2,3),0,10,rand(2,3),0);

%
% Extract all the coefficients from the array.

[Kp,Ti,Td,N,b,c] = pidstddata2(C2);

%
% Each of the outputs is itself a 2-by-3 array. For example, examine Ki.

Ti

%
% Extract only the coefficients of entry (2,1) in the array.

[Kp21,Ti21,Td21,N21,b21,c21] = pidstddata2(C2,2,1);

%
% Each of these outputs is a scalar.

Ti21

% Copyright 2015 The MathWorks, Inc.