function Z = Cost(x)
k = x(1) ; 
a = x(2) ; 
b = x(3) ; 
Tf = x(4) ; 
s = tf('s') ; 
Gc = k * (s^2 + a * s+b)/s/(1+Tf*s) ; 
system  = 0.5/(2*s+1)^2 ; 
Tcl = feedback(system * Gc , 1) ;  %% closed loop TF
StepInfo = stepinfo(Tcl) ; 
% Ts = StepInfo.SettlingTime ; 
PO = StepInfo.Overshoot ; 
% Z = 2.5*abs(Ts-2) + abs(PO - 5) ; 
t = 0:0.01:20 ; 
y = step(Tcl , t) ; 
r = ones(size(y)) ; 
e = r - y ; 
Z = sum(abs(e)) + PO ;
end