Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- # Particles data: mass and positions
- particles = {
- '5kg': {'mass': 5, 'position': (0, 0)},
- '4kg': {'mass': 4, 'position': (1, 2)},
- '3kg': {'mass': 3, 'position': (2, 0)}
- }
- # Plotting the particle positions
- plt.figure(figsize=(8, 6))
- for label, p in particles.items():
- plt.plot(p['position'][0], p['position'][1], 'o', label=f"{label} at {p['position']}")
- plt.title('Positions of Particles in a 3-Particle System')
- plt.xlabel('x [m]’); plt.ylabel('y [m]’); plt.grid(True)
- plt.axhline(0, color='black', linewidth=0.5)
- plt.axvline(0, color='black', linewidth=0.5)
- plt.legend()
- plt.axis('equal')
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement