# Creating an equation of a 2D path of an orbit

1. Aug 11, 2014

### beamthegreat

Hi all

This question came up to me when I was playing a game called KSP (a space sim game):

Given an initial velocity and starting altitude, how do you create a 2D Cartesian equation of the orbit of that projectile around earth?

For example if I told you a projectile is travelling at a speed of 8000 m/s, an altitude of 350km and tangential to the surface of the earth, how do you create an 2D Cartesian equation of the orbit?

Also, assume (0,0) is the center of the earth.

So, the equation of the earth would simply be

$y = \sqrt{6378.1^2 - x^2}$

(The radius of the earth is 6378.1 km)

Any input would be appreciated. Thanks!

Last edited: Aug 11, 2014
2. Aug 11, 2014

### SteamKing

Staff Emeritus
What is 'x' supposed to represent?

Where is the altitude considered?

The velocity of the projectile in orbit?

What do you mean by 'the equation of the earth'?

3. Aug 11, 2014

### beamthegreat

Sorry for being unclear.

"x" is supposed to represent the path of the orbit of the projectile.

The altitude is basically the distance from the surface of the earth to the object.

By 'the equation of the earth' I meant a cross section of the earth, projected onto a 2D Cartesian plane.

The velocity is the instantaneous velocity of the object at that moment. For example, if a satellite orbits the earth at an altitude of 350 km, its velocity must equal:

$v = \sqrt{Gm/r}$ ; where G is the gravitational constant, r is the distance from the center of the earth to the object, and m is the mass of the earth.

for the orbit to be circular. In this case, the velocity of the satellite is approximately 7.7 km/s and it will be always be constant.

Since the satellite will be perfectly circular, the equation of the path of the satellite in this case will be:

$y=\sqrt{(6378.1+350)^2-x^2}$

However, the equation will become much more complex if the satellite is at an altitude of 350km but is traveling faster than the orbital velocity (>7.7 km/s) since it will begin to follow an elliptical path.

I have attempted this before but failed to find a solution so I would appreciate it if you guys could enlighten me on how to solve this problem.

Update: Here's a rough diagram I drew that will hopefully clarify it even further.

Basically, find the equation of the blue dotted line, given that the velocity of the satellite is 8 km/s (tangeant to surface) when it is exactly at 350 km above the surface of the earth.

http://s29.postimg.org/jlrz9f5ef/IMG_20140811_192103.jpg

Last edited: Aug 11, 2014
4. Aug 12, 2014

### beamthegreat

Bump!

Is my explanation above clear enough? Do you have any question about what I posted above?

Any suggestion/input will be highly appreciated!

5. Aug 12, 2014

### .Scott

If you haven't looked at these, please do:
http://en.wikipedia.org/wiki/Kepler's_laws_of_planetary_motion
http://en.wikipedia.org/wiki/Escape_velocity
http://en.wikipedia.org/wiki/Standard_gravitational_parameter

I'll be back after lunch and look at this. You orbit will be an ellipse and you're starting at the perigee - along the major axis of the ellipse.
There's a way to get the apogee altitude from the perigee altitude and velocity - but you need to work through a couple of equations and a quadratic.

6. Aug 12, 2014

### .Scott

So, let's look at your 8Km/s example.
For the Earth, the standard gravitational parameter is $\mu_{e} = 398600.4418 Km^{3}/s^{2}$.
So the escape speed at radius is $v_{e}(r) = \sqrt{2\mu_{e}/r}$.
At 350Km MSL, it will be $v_{e}(6378.1+350Km) = \sqrt{2\cdot 398600.4418/6728.1} = 10.885Km/s$.

If we were at escape speed, we would be following a parabolic path. Since we are slower than escape speed, we are in an elliptical orbit with the Earth center. The major axis of the ellipse will pass through our space craft and the Earth center, and the Earth center will be at one focus point of the ellipse.

The speed for a circular orbit at that altitude is: $v_{o}(r) = \sqrt{\mu_{e}/r} = \sqrt{398600.4418/6728.1} = 7.697Km/s$. Just as you computed.

So we are faster than a circular orbit, slower than escape speed, and traveling horizontally. So we are at perigee and the Earth is at the near focus point of the ellipse that we are following.

There will be two things that don't change during our orbit:
1) The amount of energy required to reach escape velocity will always be the same. So $v_{e}(r)^2 - v^2$ will be constant.
2) Thanks to Kepler, we know that we will always be sweeping out area with our orbit at a constant rate. So $v_{t}r$ will be constant, where $v_{t}$ is the tangential component of our velocity.

At apogee and perigee, our tangential velocity will equal our orbital velocity. So using subscript "a" for apogee and "p" for perigee:
3) $v_{e}(r_{a})^2 - v_{a}^2 = v_{e}(r_{p})^2 - v_{p}^2$
4) $v_{a}r_{a} = v_{p}r_{p}$

Working with equation 3:
5) $2\mu_{e}/r_{a} - v_{a}^2 = 2\mu_{e}/r_{p} - v_{p}^2$
6) $2\mu_{e}(1/r_{p} - 1/r_{a}) = v_{p}^2 - v_{a}^2$
7) $2\mu_{e}(r_{a}-r_{p}) = r_{p}r_{a}v_{p}^2 - r_{p}r_{a}v_{a}^2$

We're looking to solve $r_{a}$ in terms of $r_{p}$ and $v_{p}$, so we need to get rid of the $v_{a}$'s.
We do this by using equation 4 to substitute in equation 7.
8) $2\mu_{e}(r_{a}-r_{p}) = r_{p}r_{a}v_{p}^2 - r_{p}^2v_{p}v_{a}$
9) $2\mu_{e}(r_{a}-r_{p}) = r_{p}v_{p}(r_{a}v_{p} - r_{p}v_{a})$

Multiply through by $r_{a}$:
10) $2\mu_{e}r_{a}(r_{a}-r_{p}) = r_{p}v_{p}(r_{a}r_{a}v_{p} - r_{a}r_{p}v_{a})$

Using equation 4 we can substitute in equation 10.
11) $2\mu_{e}(r_{a}^2-r_{p}r_{a}) = r_{p}v_{p}(v_{p}r_{a}^2 - r_{p}^2v_{p})$
12) $(2\mu_{e}-r_{p}v_{p}^2)r_{a}^2 - (2\mu_{e}r_{p})r_{a} + (r_{p}^3v_{p}^2) = 0$

In that last equation is a quadratic of $r_{a}$. Solving that messy quadratic, we actually get both the apogee and perigee. Here's the apogee:
13) $r_{a} = r_{p}(r_{p}v_{p}^2)/(2\mu_{e}-(r_{p}v_{p}^2))$

For our case:
$(r_{p}v_{p}^2) = 6728.1\cdot8^2 = 430598.4$
$r_{a} = r_{p}(430598.4/(2\cdot398600.4-430598.4)) = 1.174565r_{p} = 7902.6Km$

The MSL apogee would be 7902.6 - 6378.1 = 1519.5Km.

7. Aug 12, 2014