Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Im trying to calculate the orbits of a solar system of a three particles in a plane. I have code that kind of does what

Im trying to calculate the orbits of a solar system of a three particles in a plane. I have code that kind of does what I want it too but I would like this code to include the Verlet Method along with parameters of masses. The three "particles" being the Earth, Moon, and Sun. The Following is the code I have that correctly represents what I want to do:% Earth's Orbit
at =149.5963995; % horizontal radius
bt =149.57552243; % vertical radius
x0t =0; % x0,y0 ellipse center coordinates
y0t =0;
t =-4* pi:0.01:4* pi;
xt = x0t + at * cos(t);
yt = y0t + bt * sin(t);
n = length(xt);
% Moon's Translation around the Earth
for i =1:1:n
xt2= xt(i); % Earth's position
yt2= yt(i); % Moon's center
al =38.1575; % horizontal radius *100
bl =38.0744275597; % vertical radius *100
% Moon's Orbit
x0l = xt2-0.025165; % x0,y0 ellipse center coordinates focus
y0l = yt2;
t =-111* pi:0.01:111* pi;
xl = x0l + al * cos(t);
yl = y0l + bl * sin(t);
m = length(xl);
xs =2.4991665; % Sun's position
ys =0;
xm = xl(m -14* i);
ym = yl(m -14* i);
pts =(yt(i)- ys)/(xt(i)- xs);
plt =(ym - yt(i))/(xm - xt(i));
plot(xl, yl,'m')% Moon's orbit
hold on
plot(xl(m -14* i), yl(m -14* i),'ok', 'MarkerSize', 5, 'MarkerFaceColor', 'w')% Moon moving in its orbit
hold on
plot(xt, yt,'k')% Earth's orbit
hold on
plot(xt(i), yt(i),'ob', 'MarkerSize', 10, 'MarkerFaceColor', 'c')% Earth moving in its orbit
hold on
plot(xs, ys,'or', 'MarkerSize', 20, 'MarkerFaceColor', 'y')% fixed Sun
porcentaje =(pts - plt)/((pts + plt)/2);
per = abs(porcentaje);
if per <0.1
line([xt(i) xs],[yt(i) ys])
line([xm xt(i)],[ym yt(i)])
hold off
vector(i)= i;
end
hold off
axis([-200200-200200])
pause(.0000000001)
end

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions

Question

' How much control do you have over achieving your objectives?

Answered: 1 week ago