Simulating orbit trajectory based on position and velocity

AlenC
Messages
7
Reaction score
0
Hi!

I hope I'm posting in the correct section. I found this very similar topic in this forum: https://www.physicsforums.com/threads/orbital-ellipse.482713/

Aside from very helpful formula for calculating semi-major axis, the question was left unanswered.

I have a working simulation of orbital motion of satellites and spaceships, but I'd like to visually represent this flight path based on distance from planet's center of mass and satellite's velocity.

I assume the best way to do this is by drawing an ellipse, for which I need to know semi-major axis, semi-minor axis and eccentricity or focus. What would be the best process to do this? I don't mind doing some research and reading myself, but I'd like to understand at least the sequence of calculations I need to do.

Thanks for help in advance.

Edit: I forgot to mention that I'm simulating everything in two dimensional plane.
 
Last edited:
Astronomy news on Phys.org
Start with this:
Position in two dimensional plane is determined by single variable - distance. Right?
And for velocity, you need two variables: radial and tangential velocity. Correct?
 
  • Like
Likes   Reactions: AlenC
snorkack said:
Start with this:
Position in two dimensional plane is determined by single variable - distance. Right?
And for velocity, you need two variables: radial and tangential velocity. Correct?

Yes. I know these values. What can I do next based on this?
 
Calling the velocities Vr and Vt, we can note that kinetic energy Ek=mv2/2=m(Vr2+Vt2)/2 - at every point of orbit.
 
  • Like
Likes   Reactions: AlenC
Ok, I'm still with you.
 
The second constraint is that the potential energy Ep=-MmG/R.
Now, conservation of energy means that the total energy
E=m[(Vr2+Vt2)/2-MG/R]
is constant. If it´s positive, then the orbit is hyperbolic and the satellite escapes; if it is zero then the orbit is parabolic and the satellite also escapes..
If the energy is negative then the orbit is elliptical or circular.
Now, the tangential velocity has another constraint: second law of Kepler:
VtR must be constant.
Therefore Vt, and therefore also Vt2 cannot go to zero.
 
  • Like
Likes   Reactions: AlenC
So: E/m=(Vr2+Vt2)/2-MG/R
Also Vt=(L/m)/R, for every R.
Thus: E/m=Vr2/2+[(L/m)2/2]/R2-MG/R
rearranging, I get
Vr2/2=E/m+MG/R-[(L/m)2/2]/R2
multiplying by 2
Vr2=2(E/m)+2MG/R-(L/m)2/R2
Observe that this is a quadratic equation for (1/R).
 
Last edited:
  • Like
Likes   Reactions: AlenC
I'll need some time to process this, but I think I understand the general meaning: I can calculate energy from velocity and distance.

Would you just mind explaining what M, L and R stand for?
 
Now, Vr2 as a square cannot be negative. Whereas the member -(L/M)2/R2 is negative and can get arbitrarily small (?) as 1/R increases.
Therefore, you can solve the quadratic equation for Vr2=0, and get the two R values where Vr2=0.
These R values are the distances to apsides.
Major axis of ellipse is Rmax+Rmin.
Eccentricity is (Rmax-Rmin)/(Rmax+Rmin)
 
  • Like
Likes   Reactions: AlenC
  • #10
AlenC said:
Would you just mind explaining what M, L and R stand for?
M is the mass of the planet.
L is the angular momentum of the satellite. I preferred to use the expression (L/m), where m is the mass of satellite.
R is the distance between planet and satellite.
 
  • Like
Likes   Reactions: AlenC
  • #11
I tried using these equations in my simulation, but I'm getting strange results. Either too big or too small. Would you mind checking my numbers?

I first tried calculating total energy:

E = 10000000kg*( (7563.49ms²/2) - ((6E+24kg*6.67408E-11)/7000000m) )
Mass of the planet is approximate. I didn't include radial velocity, because at this point is zero. Tangential velocity is calculated by the simulation for a circular orbit and it works correctly (as far as I can tell). If I boost this value manually, orbit becomes an ellipse and satellite returns to its starting position.

Result calculated by the computer is: -286032000000000
But this is the result I got from windows calculator: -57206399999713968094999500

I'm obviously making a mistake somewhere...
 
  • #12
AlenC said:
E = 10000000kg*( (7563.49ms²/2) - ((6E+24kg*6.67408E-11)/7000000m) )
I get:
Vt2/2=+2,8E+7
GM=4E+14
GM/R=-5,7E+7
Your Windows calculator looks like you´ve put too many zeros to the GM/R part.
Yes: if you increase tangential speed from a circular orbit, the point becomes a perigee. If the speed remains below the escape speed, the satellite will acquire an elliptical orbit and return to the point of origin.
 
  • Like
Likes   Reactions: AlenC
  • #13
I checked the results coming out of program and they match with your calculations and my original value of E: -286032000000000

So now comes the difficult part where I'm probably making a mistake. If I understood correctly, next I have to solve quadratic equation with two results:
Vr2=2(E/m)+2MG/R-(L/m)2/R2

I used this formula:

R_1={ -B + [ sqrt(B²- (4AC) ) ] } / 2 * A
R_2={ -B - [ sqrt(B²- (4AC) ) ] } / 2 * A

I identified these elements from the formula you provided:

A = (L/m)²*-1 (should this be negative?)
B = 2MG
C = 2*(E/m)

Am I doing this correctly? Also, if I understand what you said, the result is actually 1/R, so I should multiply the result with itself?
 
  • #14
AlenC said:
So now comes the difficult part where I'm probably making a mistake. If I understood correctly, next I have to solve quadratic equation with two results:
Vr2=2(E/m)+2MG/R-(L/m)2/R2
Yes - solve it for Vr=0
AlenC said:
I used this formula:

R_1={ -B + [ sqrt(B²- (4AC) ) ] } / 2 * A
R_2={ -B - [ sqrt(B²- (4AC) ) ] } / 2 * A

I identified these elements from the formula you provided:

A = (L/m)²*-1 (should this be negative?)
Yes, negative - so no -1 there
A=-(L/m)2
AlenC said:
B = 2MG
C = 2*(E/m)

Am I doing this correctly? Also, if I understand what you said, the result is actually 1/R, so I should multiply the result with itself?
No. You need to take inverse - divide 1 by 1/R
As it happens, the expression you need to take inverse of is already expressed as a ratio, so that´s easy:
1/R1=[-B+sqrt(B2-4AC)]/2A
therefore
R1=2A/[-B+sqrt(B2-4AC)]
 
  • Like
Likes   Reactions: AlenC
  • #15
Thank you so much, it's finally working:
http://image.prntscr.com/image/60331e210381452ab979dd775141e760.png
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 7 ·
Replies
7
Views
15K