Plotting the Orbit of a Planet Using Excel

From: http://www.batesville.k12.in.us/Physics/PhyNet/Mechanics/Gravity/lab/excel_orbits.htm
Michael Fowler
Plotting the Orbit of a Planet
Using Excel
You might think that calculating and plotting the orbit of a planet would be a task well beyond
the fragile, confused mind of the beginning physicist, but that is not the case! In this activity, you
will use an Excel (or LatisPro) spreadsheet to calculate and plot the orbit of a planet. The
calculations aren't complicated, and they provide a nice review of kinematics and vector
components at the same time.
The Theory:
Overview:
Suppose we place a small planet (the Earth) in the gravitational field of a large star (the sun).
How can we calculate the orbit of the planet due to the gravitational force on it? It is relatively
easy to perform an iterative calculation - that is, use the planet's current position and velocity to
calculate its position and velocity a short time later, then use this position and velocity to
calculate another position, and so on. Here's how the calculation goes:
If we know the planet's position, we can calculate its distance, r, from the star.
If we know the distance between the planet and the star, we can calculate the gravitational
force on the planet.
If we know the gravitational force on the planet, we can calculate the planet's acceleration.
If we know the planet's acceleration, we can calculate how much its velocity will change in a
short time, t.
If we know the planet's new velocity, we can calculate how much its position will change in a
short time, t.
Go back to step 1.
The Details: (discussed with the pupils)
As an initial simplification, suppose that the star we are going to orbit is massive enough that we
can consider it at rest at the origin. Now, place a planet in the star's gravitational field at point (x,
y), and give it initial velocity components (vx, vy). The distance, r, between the star and the planet
can be found easily from the Pythagorean Theorem:
We can now calculate the gravitational force on the planet from Newton's Law of Universal
Gravitation:
Given the gravitational force on the planet, we can calculate its acceleration from Newton's
Second Law:
To find the x- and y-components of the acceleration we can use similar triangles, as seen in the
diagram below:
(The negative signs were introduced in the equations above to account for the fact that the
acceleration components are in the opposite direction from x and y.)
Now, suppose the planet is allowed to move for a short time, t. The planet's velocity will change
by an amount axt in the x-direction, and ayt in the y-direction, so the planet's new velocity
components will be given by Euler's method:
vx-new = vx + axt
vy-new = vy+ayt
Now that we know the planet's new velocity, we can calculate how far it will move in the short
time t. To simplify things, if the time is short we can consider the planet's velocity approximately
constant, and:
xnew = x + vyt
ynew = y + vyt
Create the Spreadsheet the predict the Earth's orbit:
Even though this is a simple calculation, there is a fair amount of calculating to do to move a
planet a very short distance - and the calculation cycle needs to be repeated many times in order
to complete a single orbit. It makes sense to use a spreadsheet to do this repetitive calculation for
us, and most spreadsheets will even graph the results!
Here is a way to perform the calculations shown above using Excel. We assume that the
(immovable) star is located at the origin, and the planet always starts from position (r0, 0). The
x-component of the planet's velocity is always 0, and you can adjust the y-component of the
planet's velocity (in cell B16) in order to see its effect on the orbit.
The value in cell B13 represents the (short) time, t, between calculated positions. You may
change it if you like.
To construct the spreadsheet, copy the values and formulas shown below into rows 1-22 of your
spreadsheet. Then use the copy feature of the spreadsheet to copy columns B to G - since each
row calculates one position of the planet in its orbit, you will need at least 100 rows.
When you think the spreadsheet is working, use the Chart Wizard to make a scatter plot of the xand y-positions (columns B and C) of the planet and Excel will plot the data points for you. I
recommend making the chart in its own page, so you can have a nice, big picture.
Depending on the situation, your graph may contain too many or too few points, adjust the
number of points plotted using the "Source" option in the Chart Menu.
To adjust the spacing of the points on the graph, edit the time between calculations, dt (cell B13).
Reference: The idea for this calculation originally came from the amazing Feynman Lectures on
Physics many, many years ago. I calculated and plotted my first orbits (by hand and slide rule!)
using this technique before spreadsheet programs were invented!
Effect of the initial parameters on the orbit
•
Do you have to take the planet's mass into account ?
•
Test the effect of the initial velocity.
•
Test the effect of the planet's initial position.
•
Report your results, with graphs included, and conclude. Is the motion path always a
closed curve ? Does the number of significant figures have a big effect on the result ?
Limits of the iterative calculation
Test the effect of change in delta-t (time between calculations)
Graph obtained with delta-t =4 days:
•
1,75E+011
1,50E+011
1,25E+011
1,00E+011
7,50E+010
5,00E+010
2,50E+010
0,00E+000
-2,50E+010
-5,00E+010
-7,50E+010
-1,00E+011
-1,25E+011
-1,50E+011
-1,75E+011
-2,00E+011
-1,00E+011
0,00E+000
Graph obtained with delta-t = 8 days.
1,00E+011
2,00E+011
1,75E+011
1,50E+011
1,25E+011
1,00E+011
7,50E+010
5,00E+010
2,50E+010
0,00E+000
-2,50E+010
-5,00E+010
-7,50E+010
-1,00E+011
-1,25E+011
-1,50E+011
-1,75E+011
-2,00E+011
-1,00E+011
0,00E+000
1,00E+011
2,00E+011
1,00E+011
2,00E+011
Graph obtained with delta-t = 20 days
3,75E+012
3,50E+012
3,25E+012
3,00E+012
2,75E+012
2,50E+012
2,25E+012
2,00E+012
1,75E+012
1,50E+012
1,25E+012
1,00E+012
7,50E+011
5,00E+011
2,50E+011
0,00E+000
-2,50E+011
-5,00E+011
-2,00E+011
-1,00E+011
0,00E+000
Unless you go with either a very small timeslice or only a few orbits, there is a chance that using
the Euler method will not give you a closed orbit. Errors in the timestep cause the orbits to fall
outwards.
•
List the approximations made to perform the orbit calculations.
- motionless sun
- other planets acting no gravitational effect on the Earth
- speed and acceleration keep constant during delta-t.
Can you trust any calculation result ?
Graph obtained for v0= 10000 m/s and delat-t = 4 days.
*
3,0E+11
2,0E+11
Y
1,0E+11
0,0E+00
-1,0E+11
-2,0E+11
-3,0E+11
-3,00E -2,00E -1,00E
+011
+011
+011
0,00E
+000
1,00E
+011
2,00E
+011
3,00E
+011
X
Graph obtained for v0= 10000 m/s and delta-t = 10 days
*
3,0E+11
2,0E+11
Y
1,0E+11
0,0E+00
-1,0E+11
-2,0E+11
-3,0E+11
-3,00E
+011
-2,00E
+011
-1,00E
+011
0,00E
+000
1,00E
+011
2,00E
+011
3,00E
+011
X
Compare the same spreadsheet made with two different softwares (excel, OPen Office, LatisPro).
Is there any difference in the results ?
Graph obtained with Excel :
*
3,0E+11
2,0E+11
Y
1,0E+11
0,0E+00
-1,0E+11
-2,0E+11
-3,0E+11
-3,00E -2,00E -1,00E 0,00E
+011
+011
+011
+000
1,00E
+011
2,00E
+011
3,00E
+011
X
Graph obtained with LatisPro (same parameters) :
Test your method
•
Test Your method on the solar system using data from :
http://nssdc.gsfc.nasa.gov/planetary/factsheet
Predict each planet's orbit knowing r0 and v0, and check whether the predicted orbital
period Texp matches the theoretical value T.
•
How accurate is your experimental result ? (think of delta-t)
Example for Earth :
Orbital parameters
Semimajor axis (106 km)
Sidereal orbit period (days)
Tropical orbit period (days)
Perihelion (106 km)
Aphelion (106 km)
Mean orbital velocity (km/s)
Max. orbital velocity (km/s)
Min. orbital velocity (km/s)
Orbit inclination (deg)
Orbit eccentricity
149.60
365.256 = T
365.242
147.09 = r0
152.10
29.78
30.29 = v0
29.29
0.000
0.0167
Sidereal rotation period (hrs)
Length of day (hrs)
Obliquity to orbit (deg)
23.9345
24.0000
23.45
Mercury :Texp=47 days (time taken for x to reach 0 twice)
T=88 days
Venus : Texp= 222 +- 4 days
T=224 days
Earth : Texp= 361 days +- 4 days
T= 365 days
Mars :Texp= 537 days
T= 687 days