% Paper 2009 Vrancic et al. Improving disturbance rejection of PID 
% controllers by means of the magnitude optimum method;
% ISA Transactions 2009, 10 pages; plant 5, plant equation (31):
Vs5=3.04;   num5=1;   den5=[173   35.5   1];
TF=2;                 den5F=[TF   1];
                      den5t=conv(den5,den5F);
GPl5=tf(Vs5*num5,den5,'Variable','p'),

Ru5=bo_u_gen02(13,Vs5,num5,den5t), %PID undelayed input [VR,TN,T0,TV,TQ,TT]
% for comparison paper table 7:
Ru5_CompPaper=[ Ru5(1)  Ru5(1)/Ru5(2)  Ru5(1)*Ru5(4) ]
% for simulink:
Ru5zae=[ Ru5(4)*Ru5(2)  Ru5(2)  1],
Ru5nen=conv(den5F,[Ru5(3)  0]),    % Ru5(3) = TR0 = integrator
GCu5=tf(Ru5zae,Ru5nen),    % controller transfer function (undelayed input)

Rd5=bo_d_gen02(13,Vs5,num5,den5t), %PID delayed inputs [VR,TN,T0,TV,TQ,TT]
% for comparison paper table 7:
Rd5_CompPaper=[ Rd5(1)  Rd5(1)/Rd5(2)  Rd5(1)*Rd5(4) ]
% for simulink:
Rd5zae=[ Rd5(4)*Rd5(2)  Rd5(2)  1],
Rd5nen=conv(den5F,[Rd5(3)  0]),    % Rd5(3) = TR0 = integrator
GCd5=tf(Rd5zae,Rd5nen),      % controller transfer function (delayed input)
Fd5=[ Rd5(4)*Rd5(2)  Rd5(2)  1],   % pre-filter denominator
GFd5=tf(1,Fd5);                    % pre-filter transfer function

% pre-filter optimization
OptPreFi5_4 = bo_prefi_op(GPl5,GCu5,GCd5,GFd5),   % use of default order =4
OptPreFi5_3 = bo_prefi_op(GPl5,GCu5,GCd5,GFd5,3), % order =3