def plot_initial_and_optimized_controls(time_points, \
udata_init, udata_opt, umin, umax):
pl.rc("text", usetex = True)
pl.rc("font", family="serif")
pl.subplot2grid((2, 1), (0, 0))
pl.step(time_points[:-1], udata_init[:,0], label = "$\delta_{init}$")
pl.step(time_points[:-1], udata_init[:,1], label = "$D_{init}$")
pl.plot([time_points[0], time_points[-2]], [umin[0], umin[0]], \
color = "b", linestyle = "dashed", label = "$\delta_{min}$")
pl.plot([time_points[0], time_points[-2]], [umax[0], umax[0]], \
color = "b", linestyle = "dotted", label = "$\delta_{max}$")
pl.plot([time_points[0], time_points[-2]], [umin[1], umin[1]], \
color = "g", linestyle = "dashed", label = "$D_{min}$")
pl.plot([time_points[0], time_points[-2]], [umax[1], umax[1]], \
color = "g", linestyle = "dotted", label = "$D_{max}$")
pl.ylabel("$\delta,\,D$", rotation = 0)
pl.ylim(-0.6, 1.1)
pl.title("Initial and optimized controls")
pl.legend(loc = "upper right")
pl.subplot2grid((2, 1), (1, 0))
pl.step(time_points[:-1], udata_opt[:,0], label = "$\delta_{opt,coll}$")
pl.step(time_points[:-1], udata_opt[:,1], label = "$D_{opt,coll}$")
pl.plot([time_points[0], time_points[-2]], [umin[0], umin[0]], \
color = "b", linestyle = "dashed", label = "$\delta_{min}$")
pl.plot([time_points[0], time_points[-2]], [umax[0], umax[0]], \
color = "b", linestyle = "dotted", label = "$\delta_{max}$")
pl.plot([time_points[0], time_points[-2]], [umin[1], umin[1]], \
color = "g", linestyle = "dashed", label = "$D_{min}$")
pl.plot([time_points[0], time_points[-2]], [umax[1], umax[1]], \
color = "g", linestyle = "dotted", label = "$D_{max}$")
pl.xlabel("$t$")
pl.ylabel("$\delta,\,D$", rotation = 0)
pl.ylim(-0.6, 1.1)
pl.legend(loc = "upper right")
pl.show()
评论列表
文章目录