Kaarthic P.Portfolio

Planets Orbiting Simulation

The objective of this project was to use MATLAB to create an accurate 2-D simulation of the planets (and Pluto) orbiting the sun in our solar system. To achieve this goal, I followed a several step procedure. The first step was to collect all relevant data on the planets in the solar system. This included number of orbit days, major and minor axes of the elliptical orbit, and tilt of the ellipse relative to standard position.

Once the data was collected or calculated, I compiled it into an Excel spreadsheet to be read by the MATLAB script. Next, the initial position of the planets was calculated from http://www.theplanetstoday.com/, to be used as a baseline from which to start the simulation.

Next, the ellipse itself had to be plotted for each planet. I used parametric equations to use an independent variable to draw the ellipse for a given planet, using the data collcected from the Excel sheet. In order to fully define a planet on its elliptical orbit, I had to start the simulation at its initial position, shift the ellipse according to its perihelion and aphelion, and rotate the ellipse so that it resembled the true orbit of the planet.

The offset and shifts were easily solved by adding the values in the appropriate place. To rotate the ellipse, I used a rotation matrix to apply a rotation transformation to the figure. This causes each point in the orbit to be rotated by a given amount before being displayed, thus making the entire ellipse rotate.

Once each planet could be plotted, I put it all together to make all the planets move together. As an add on, I made it possible to calculate the distance between any planet at the end of the simulation. Lastly, the user was given the control to choose how many days to run the simulation, day increment for each iteration, as well as the planet from which to calculate the final distances.

Final Possible Simulation Results: