Simple Orbit problem Sun and Jupiter
조회 수: 4 (최근 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
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?
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Gravitation, Cosmology & Astrophysics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!