%% Extract Standard-Form 2-DOF PID Coefficients from Equivalent System
% Extract coefficients from a two-input, one-output dynamic system that represents a valid 2-DOF standard-form PID controller.
% The following A, B, C, and D matrices form a discrete-time state-space model that represents a 2-DOF PID controller in standard form.

A = [1,0;0,0.5];
B = [0.1,-0.1;-0.25,0.5];
C = [4,400];
D = [220,-440];
sys = ss(A,B,C,D,0.1)

%
% Extract the PID coefficients, filter divisor, and setpoint weights of the model.

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

% For a discrete-time system, pidstddata2 calculates the coefficient values using the default ForwardEuler discrete integrator formula for both IFormula and DFormula.
% Copyright 2015 The MathWorks, Inc.