www.gusucode.com > control 案例程序 matlab源码代码 > control/ConvertDynamicSystemTo2DOFParallelFormPIDControllerExample.m

    %% Convert Dynamic System to 2-DOF Parallel-Form PID Controller
% Convert a discrete-time dynamic system that represents a 2-DOF PID controller
% with derivative filter to parallel |pid2| form.  
%%
% The following state-space matrices represent a discrete-time 2-DOF PID controller with
% a sample time of 0.1 s.

% Copyright 2015 The MathWorks, Inc.

A = [1,0;0,0.99];
B = [0.1,-0.1; -0.005,0.01];
C = [3,0.2];
D = [2.6,-5.2];
Ts = 0.1;
sys = ss(A,B,C,D,Ts);
%%
% When you convert |sys| to 2-DOF PID form, the result depends on which discrete
% integrator formulas you specify for the conversion.  For instance, use
% the default, |ForwardEuler|, for both the integrator and the derivative.
C2fe = pid2(sys)
%%
% Now convert using the |Trapezoidal| formula.
C2trap = pid2(sys,'IFormula','Trapezoidal','DFormula','Trapezoidal')
%%
% The displays show the difference in resulting coefficient values and
% functional form.