Hi(adsbygoogle = window.adsbygoogle || []).push({});

Im busy creating an application to simulation a rocket in orbit. Im having trouble as the results im getting are incorrect. Could someone please check if im using the correct method as stated below.

Everything works on a 2d plane, and has a x and y coordinate and a x and y velocity and a mass

coordinates are in meters and the mass is in kg.

Method:

Calculate the distance between the rocket and the planet using the distance formula

distance = sqrt[ ( x2 - x1)^2 - (y2 - y1)^2 ]

calculate the force earth exerts on the rocket using the The Universal Law of Gravitation where G is the Gravitational constant m is the mass of an object and r is the distance between them

force = (G*m1*m2) / distance^2

Using the inverse of tan get the angle to calculate the the x and y components ( I know for a fact im getting this is correct, its a bit tricky to explain) I calculate the angle for each quadrant going from the x axis to the y axis

Calculate the acceleration of the rocket

acceleration = force / mass

Calculate velocity change over timer ( this is usually 0.01 seconds )

deltaVelocity = acceleration * time

Calculate the x velocity component

deltaXvelocity = deltaVelocity * cos(angle)

Calculate the y velocity component

deltaYvelocity = deltaVelocity * sin(angle)

Calculate the new x velocity

newXvelocity = currentXvelocity + deltaXvelocity

Calculate the new y velocity

newYvelocity = currentYvelocity + deltaYvelocity

set the new position of the rocket

newXposition = currentXposition + ( newXvelocity * time )

newYposition = currentYposition + ( newYvelocity * time )

Something is wrong with this method and i do know what.

I know for a fact that a an object in orbit round about 420km travelling at round about 7700 m/s should be in a roughly circular orbit and one that has a high eccentricity.

Currently with the results im getting to obtain a roughly circular orbit at 420km i need to have a velocity of round about 5500m/s

Thanks for taking the time

**Physics Forums - The Fusion of Science and Community**

# Orbital simulation - Calculate object position over time in a 2d plane

Have something to add?

- Similar discussions for: Orbital simulation - Calculate object position over time in a 2d plane

Loading...

**Physics Forums - The Fusion of Science and Community**