space craft trajectory (earth to moon)

5 visualizzazioni (ultimi 30 giorni)
Blob
Blob il 5 Mag 2023
Modificato: Blob il 5 Mag 2023
Hello! So I am trying to simulate ths trajectory of a spacecraft that goes from earth to the moon, the problem is that there's a variable in the motion equation (sun an moon postition) that mus change fo a certain time, to be more clear this is a simulation for a tspan = 3days, so the moon and sun position must change durring day 1, 2 and 3. But I am confused on how to do so, knowing that I am using ode45 to find the solution of the motion equation.
I did an if statment, but it did not give the results I wanted
  2 Commenti
John D'Errico
John D'Errico il 5 Mag 2023
You did an if statement and it did not give the results you wanted. So write better code, but first, understand the problem you are trying to model. There is no question in this about MATLAB. If there was, you would have shown what you tried, and asked for help in fixing it.
I would start with a simple three body problem, solving for the relative positions of the earth and moon in the gravitational field of the sun. (Actually, long term predictions for even a three body system can be difficult to predict, but this is not long term in context.)
Having done that, AND having shown to yourself that your model has predictive capability, then now I might throw in a 4th body, the space craft. Since it is so small relative to the other terms, the spacecraft will have no impact on the behavior of the eart, sun, moon system. They will impact it, of course. So the inital 3 body equations do not change at all. You are only adding another equation in effect.
There is no if statement to worry about here, except for possibly deciding when the craft crashes into the moon. And even that does not require an if statement, but an ODE event, so when the position of the craft with the surface of the moon is less then the radius of the moon..
Blob
Blob il 5 Mag 2023
Modificato: Blob il 5 Mag 2023
@John D'Errico if you wish to see my code here it is! and no, this is not a homework (if it was I would go directly to my professors), the reason why I am posting my question here, is to unsure that I have an answer from 'an engineer'. That's all, thank you for your help

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Gravitation, Cosmology & Astrophysics in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by