I'm trying to simulate moon orbit around earth, my moon is broken.

Click For Summary
SUMMARY

The forum discussion centers on simulating the moon's orbit around the Earth using a 2D model in Microsoft Excel. The user employs gravitational equations and a macro to calculate the moon's position over time, but encounters issues with the accuracy of the simulation. Key points include the need for proper time step integration in the calculations and the importance of using radians for trigonometric functions. Suggestions from other users highlight the use of the atan2 function to simplify angle calculations and the necessity of adjusting the simulation parameters for more accurate results.

PREREQUISITES
  • Understanding of gravitational physics, specifically Newton's law of universal gravitation.
  • Familiarity with Microsoft Excel macros and VBA programming.
  • Knowledge of trigonometric functions and their applications in physics.
  • Basic concepts of orbital mechanics, including circular motion and gravitational acceleration.
NEXT STEPS
  • Implement the atan2 function in the angle calculation to improve accuracy.
  • Research proper integration techniques for simulating motion, such as Euler's method or Runge-Kutta methods.
  • Explore the differences between using degrees and radians in trigonometric calculations.
  • Investigate the limitations of Excel for large-scale simulations and consider alternative programming environments like Python or MATLAB.
USEFUL FOR

Students and hobbyists interested in physics simulations, particularly those focusing on orbital mechanics and gravitational interactions. This discussion is also beneficial for anyone looking to enhance their skills in Excel programming and VBA for scientific applications.

  • #31
BvU said:
Enjoyed playing with this, even though I just noticed I was a little too late !:frown:

Ah well, no worries! Thanks anyway :D

I toyed around with my moon and set the initial position and speed to the moon's perigee and max velocity: http://nssdc.gsfc.nasa.gov/planetary/factsheet/moonfact.html

Ran it like that and I got a very neat eclipse orbit with it's apogee nearly exactly at where our moon's actual apogee is.

Now to start coding my moon ship so I can get a Hohmann transfer underway!


adjacent said:
Is excel this powerful? I though it's something accountants use for their work. -_-

It's got a whole programming language under the hood that can be utilized. Of course, it's not the best qua performance to run an astrophysics simulation, but Excel's all we have at school, and it works perfectly fine!
 
Physics news on Phys.org
  • #32
BvU said:
You want to update the vx and vy using the * timestep too !

He did, read the code again.
 
  • #33
Borek said:
He did, read the code again.
You're right. I had moved the *timestep down to the vx, vy expression to keep dimension of a in lline with naming and also to get the right values for ax, ay, am in the table. In fact, now I start wondering if the expression for px, py improves if 0.5 * timestep is used instead of *timestep...
 
  • #34
adjacent said:
Is excel this powerful? I though it's something accountants use for their work. -_-
Excel on its own is already extremely powerful. With VBA as programming language with quite some object orientation is powerful squared.

Biggest drawback is that in practice it is the epitome of unstructured programming, so re-use and knowledge transfer are disaster areas.

Having said that, there's an awful lot of science and technology it can be (and is) used for.
 

Similar threads

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