Simple Orbit problem Sun and Jupiter

1 次查看(过去 30 天)
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 个评论
Geoff Hayes
Geoff Hayes 2014-10-9
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 2014-10-9
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

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by