Vs=1;  nump=1;
denp=conv([7  1],conv([6  1],conv([5  1],conv([ 4  1] ,[ 3   1 ]))));
SP5=tf(nump,denp); % LTI continuous transfer function
Regu3=bo_u_gen(13,Vs,nump,denp), % continuous PID undelayed for comparison
Regd3=bo_d_gen(13,Vs,nump,denp), % continuous PID delayed for comparison
       
%z-transform of the plant; sampling time: T
T=1;   [zz,nz]=trans(nump,denp,T,0,1); 
SZ5=tf(zz,nz,T); % LTI discontinuous transfer function

SV3=[0 0 0 0 3];          BODu5=bod(SZ5,SV3),     % discont. PID2 undelayed
SV8=[1 0 0 0 2]; [BODd5o,FId5o]=bod(SZ5,SV8),     % discont. PID delayed
SV5=[3 0 0 1 1]; [BODd5,FId5]  =bod_gen(SZ5,SV5), % discont. PID2 delayed

Pla=SZ5;  C_ref=BODu5;,   PFi_ref=tf(1,1,T);
          C_sys=BODd5;    PFi_sys=FId5;
OPF_PID3 = bod_prefi_opt(Pla,C_ref,PFi_ref,C_sys,PFi_sys,3),
OPF_PID4 = bod_prefi_opt(Pla,C_ref,PFi_ref,C_sys,PFi_sys,4),
OPF_PID5 = bod_prefi_opt(Pla,C_ref,PFi_ref,C_sys,PFi_sys,5),

disp('"bod_prefi_opt_check05_sim.slx" will be called - compare parameters')
bod_prefi_opt_check05_sim; sim('bod_prefi_opt_check05_sim',300),
disp('Repeat bod call at MATLAB promt, if search algorithm fails')
