Answered step by step
Verified Expert Solution
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 ; horizontal radius
bt ; vertical radius
xt ; xy ellipse center coordinates
yt ;
t pi:: pi;
xt xt at cost;
yt yt bt sint;
n lengthxt;
Moon's Translation around the Earth
for i ::n
xt xti; Earth's position
yt yti; Moon's center
al ; horizontal radius
bl ; vertical radius
Moon's Orbit
xl xt; xy ellipse center coordinates focus
yl yt;
t pi:: pi;
xl xl al cost;
yl yl bl sint;
m lengthxl;
xs ; Sun's position
ys ;
xm xlm i;
ym ylm i;
pts yti ysxti xs;
plt ym ytixm xti;
plotxl ylm Moon's orbit
hold on
plotxlm i ylm iok 'MarkerSize', 'MarkerFaceColor', w Moon moving in its orbit
hold on
plotxt ytk Earth's orbit
hold on
plotxti ytiob 'MarkerSize', 'MarkerFaceColor', c Earth moving in its orbit
hold on
plotxs ysor 'MarkerSize', 'MarkerFaceColor', y fixed Sun
porcentaje pts pltpts plt;
per absporcentaje;
if per
linexti xsyti ys
linexm xtiym yti
hold off
vectori i;
end
hold off
axis
pause
end
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started