Azzera filtri
Azzera filtri

Simple Orbit problem Sun and Jupiter

4 visualizzazioni (ultimi 30 giorni)
Douglas Alves
Douglas Alves il 9 Ott 2014
Modificato: Walter Roberson il 27 Ago 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 Commenti
Geoff Hayes
Geoff Hayes il 9 Ott 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 il 9 Ott 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

Accedi per commentare.

Risposte (0)

Categorie

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

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by