N-body animation
Short script for N-body simulation. Parameters adjustable in script.
Notes:
Default is 50 planets.
Try 15 planets if animation is slow/chunky.
Uses SI Euler, so main computational cost is graphics.
Dot sizes are proportional to planet masses.
Feel free to modify/improve.
Cite As
Silas Henderson (2026). N-body animation (https://www.mathworks.com/matlabcentral/fileexchange/69834-n-body-animation), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- Sciences > Physics > Gravitation, Cosmology & Astrophysics >
- Sciences > Geoscience > Earth and Planetary Science >
Tags
Communities
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.31 | fix name, update video |
||
| 1.3 | replace 'plot, hold on' with 'line'. Also, reformat |
||
| 1.1.125 | remove comments |
||
| 1.1.124 | description |
||
| 1.1.122 | description |
||
| 1.1.121 | comment style |
||
| 1.1.12 | script formatting / style |
||
| 1.1.11 | update description |
||
| 1.1.1 | tags |
||
| 1.1.0 | Clarify Description |
||
| 1.0.9 | none |
||
| 1.0.8 | clip link |
||
| 1.0.7 | okay done for now |
||
| 1.0.5 | none |
||
| 1.0.4 | none |
||
| 1.0.3 | none |
||
| 1.0.2 | none |
||
| 1.0.1 | none |
||
| 1.0.0 |
