Simple Orbit problem Sun and Jupiter

2 vues (au cours des 30 derniers jours)
Douglas Alves
Douglas Alves le 9 Oct 2014
Modifié(e) : Walter Roberson le 27 Août 2017
Hello,
I'm trying to plot an orbit with the Sun and Jupiter only. I assumed circular orbit and all the simplicity posible still, my ode45 part does not work. Could you guys help me with this.
I put the code below. Why ode45 does not work.
The equation is a 2nd order diferential equation.
a''=-a - const* . I want to solve for a but ode45 does not even go inside the orbit function.
function SunsOrbit
% Simple 2 body problem with Jupiter and the Sun
%
%
%Setting up Constants
K.d=7.785e8 ; %km distance Jupiter-Sun
K.Mj=1.898e27; %kg
K.Msun= 1.989e30; %kg
K.mi=K.Mj*K.Msun/(K.Mj+K.Msun);
K.Vj=724.7800; %km/h Jupiter's velocity
K.Pj=K.Mj*K.Vj; % Jupiter's linear momentum
K.l=K.d*K.Pj; % Angular Momentum Modulus
K.G=6.67384e-11; % m3 kg-1 s-2
K.gamma = -K.G*K.Mj*K.Msun;
%
Inits=[-1/K.d^2*K.Vj,1/K.d^2*K.Vj];
ThetaRange=[0,2*pi];
[Theta,da]=ode45(@orbit,ThetaRange,Inits,[],K);
% Orbit's equation
function da=orbit(K)
da=zeros(1,2);
da(1)=(-1/r.^2).*K.Vj;
da(2)=((-1./r)+(-K.mi)./(K.l))*K.gamma;
  2 commentaires
Geoff Hayes
Geoff Hayes le 9 Oct 2014
Douglas - when you say that your ode45 part does not work, what exactly do you mean? Are you observing an error of some kind, and if so, what is it?
Running your code as is does produce the Too many input arguments error message. Is this what you are seeing, and if so, why did you not include this information in your question?
Douglas Alves
Douglas Alves le 9 Oct 2014
Hi Geoff, I just noticed that I forgot to enter Theta and da in orbit. But I still have an error like Error using norm LAPACK loading error: dlopen: cannot load any more object with static TLS

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Gravitation, Cosmology & Astrophysics dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by