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

    %% Convert Time Delay in Discrete-Time Model to Factors of 1/z
% This example shows how to convert a time delay in a discrete-time model
% to factors of 1/_z_.
%%
% In a discrete-time model, a time delay of one sampling interval is
% equivalent to a factor of 1/_z_ (a pole at _z_ = 0) in the model.
% Therefore, time delays stored in the |InputDelay|, |OutputDelay|, or
% |IODelay| properties of a discrete-time model can be rewritten in the
% model dynamics by rewriting them as poles at _z_ = 0. However, the
% additional poles increase the order of the system. Particularly for large
% time delays, this can yield systems of very high order, leading to long
% computation times or numerical inaccuracies.
%%
% To illustrate how to eliminate time delays in a discrete-time closed-loop
% model, and to observe the effects of doing so, create the following
% closed-loop system:
%%
% 
% <<../delay2z1.png>>
% 
%%
% _G_ is a first-order discrete-time system with an input delay, and _C_ is
% a PI controller.
G = ss(0.9,0.125,0.08,0,'Ts',0.01,'InputDelay',7);
C = pid(6,90,0,0,'Ts',0.01);
T = feedback(C*G,1);
%%
% Closing the feedback loop on a plant with input delays gives rise to internal
% delays in the closed-loop system.  Examine the order and internal delay
% of |T|.
order(T)
%%
T.InternalDelay
%%
% |T| is a second-order state-space model.  One state is contributed by the
% first-order plant, and the other by the one pole of the PI controller.
% The delays do not increase the order of |T|.  Instead, they are
% represented as an internal delay of seven time steps.
%% 
% Replace the internal delay by $z^{-7}$.
Tnd = absorbDelay(T);
%% 
% This command converts the internal delay to seven poles at _z_ = 0. To
% confirm this, examine the order and internal delay of |Tnd|.
order(Tnd)
%%
Tnd.InternalDelay
%% 
% |Tnd| has no internal delay, but it is a ninth-order model, due to the
% seven extra poles introduced by absorbing the seven-unit delay into the
% model dynamics.  
%%
% Despite this difference in representation, the responses of |Tnd|
% exactly match those of |T|.
stepplot(T,Tnd,'r--')
legend('T','Tnd')
%%
bodeplot(T,Tnd,'r--')
legend('T','Tnd')