def mycost(C): th, accel = step_response(C) ts = measurement_utils.find_settling_time(th, u, t, p=0.01) mp = th.max()/u[-1] return ts + (mp-1)
blist = Ga5.Ga5.num.coeffs.tolist() gain = blist[0] z = blist[1]/gain #ig = Ga5.Ga5.den.coeffs[1:].tolist() + [gain] ig = array([44.46407632, 258.87341724, 276.53309716, 453.43453413]) #ig = Ga5.Ga5.den.coeffs[1:].tolist() + Ga5.Ga5.num.coeffs.tolist() #ig = Ga5.Ga5.den.coeffs[1:].tolist() + [0] + Ga5.Ga5.num.coeffs.tolist() #ig = Ga5.Ga5.den.coeffs[1:].tolist() + Ga5.Ga5.num.coeffs.tolist() + [1.01] ## ig = array([ 1.63492735e+01, 3.10898809e+02, 9.44903871e+02, ## 2.48671857e+02, 3.13400963e+02, 6.62214709e-01]) ## ig = array([ 1.63492735e+01, 3.10898809e+02, 9.44903871e+02, ## 1.0, 240.0]) th_Ga5, a_Ga5 = step_response(ig, calca=True) ts_Ga5 = measurement_utils.find_settling_time(th_Ga5, u, t, p=0.01) figure(1) clf() plot(t,u, label=None) plot(t,th_Ga5, label='$\\theta_{Ga5}$') plot(t,a_Ga5, label='$\\ddot{x}_{Ga5}$') C2 = array([ 43.06911092, 317.7518689 , 642.30362953, 250, 245]) ## th2, a2 = step_response(C2, calca=True) ## plot(t,th2, label='$\\theta_{2}$') ## plot(t,a2, label='$\\ddot{x}_{2}$')