Short script for N-body simulation. Parameters adjustable in script.
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.
Silas Henderson (2020). N-body animation (https://www.mathworks.com/matlabcentral/fileexchange/69834-n-body-animation), MATLAB Central File Exchange. Retrieved .
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!