disp('demo_BOD_rst')
%
z62=1/20, n62=[100/20  102.1/20  20/20],  % plant without dead time
G62=tf(z62,n62),                          % transfer function definition
Tdt=0.7,                                  % dead time
%
T1=0.2
deltaT1=mod(Tdt,T1), % remaining dead time related to modified z-transform
Shift1=floor(Tdt/T1),    % integer dead time related to sample time
CHECK1=T1*Shift1+deltaT1,    % original Theta arrises?
   if abs(CHECK1-Tdt)>eps    % workaround
      Shift1=floor((Tdt+eps)/T1), CHECK1=T1*Shift1+deltaT1,
      if abs(CHECK1-Tdt)>eps error('Wrong check Tdt and T1!'), end, end
G62_Z1_=trans(G62,T1,deltaT1,1), % Z-transformation without Shift
if Shift1~=0
   Z_shift1=zeros(1,Shift1+1),
   N_shift1=Z_shift1;
   Z_shift1(Shift1+1)=1,
   N_shift1(1)=1;
   G62_Z1=G62_Z1_*tf(Z_shift1,N_shift1,T1),  % consideration of Shift
else G62_Z1=G62_Z1_,
end
[R62_1,S62_1,T62_1]=bod_rst(G62_Z1,[2 0 1])       % Landau RST T1
%  
T2=0.2,
deltaT2=mod(Tdt,T2), % remaining dead time related to modified z-transform
Shift2=floor(Tdt/T2),    % integer dead time related to sample time
CHECK2=T2*Shift2+deltaT2,    % original Theta arrises?
   if abs(CHECK2-Tdt)>eps    % workaround
      Shift2=floor((Tdt+eps)/T2), CHECK2=T2*Shift2+deltaT2,
      if abs(CHECK2-Tdt)>eps error('Wrong check Tdt and T2!'), end, end
G62_Z2_=trans(G62,T2,deltaT2,1), % Z-transformation without Shift
if Shift2~=0
   Z_shift2=zeros(1,Shift2+1),
   N_shift2=Z_shift2;
   Z_shift2(Shift2+1)=1,
   N_shift2(1)=1;
   G62_Z2=G62_Z2_*tf(Z_shift2,N_shift2,T2),  % consideration of Shift
else G62_Z2=G62_Z2_,
end
[R62_2,S62_2,T62_2]=bod_rst(G62_Z2,[3 0 1])       % Landau RST T2
%
demo_BOD_rst_s; sim('demo_BOD_rst_s',55)
