def plot_range_for_velocity(v_min, v_max, step=500, save_to_file=None): vx, vy_min, vy_max = [], [], [] for v in range(v_min, v_max, step): # print v to indicate progress print(v) # run sim for desired velocity sim = Sim(planet_name, capsule_name, 80000) sim.set_v0(v) rng = get_angle_range(sim, step=0.01) if len(rng) > 0: # makes sure that even if it is impossible to land, the program won't crash after hours # store data vx.append(v) vy_min.append(rng[0]) vy_max.append(rng[-1]) # plot f, ax = plt.subplots(1) ax.plot(vx, vy_min, 'bo') ax.plot(vx, vy_max, 'ro') plt.xlabel('$ v_0 $ [m/s]') plt.ylabel('$ \phi_0 [°]$') plt.title(r'Min and max $ \phi_0(v_0) $') if save_to_file is not None: plt.savefig(save_to_file) plt.show()