In the early 17th century Johannes Kepler developed the equation, now often refe
ID: 3761813 • Letter: I
Question
In the early 17th century Johannes Kepler developed the equation, now often referred to as Kepler's equation for the solution of the mean anomaly (M) of a planet in an elliptical orbit as a function of it's eccentricity (e) and it's eccentric anomaly (E).
E - e*sin[E] = M
If you are interested in exactly what this equation represents please feel free to look deeper into orbital mechanics. Curtis's Orbital Mechanics for Engineers is an excellent place to start. For this assignement however the important thing to notice is that given E and e, solving for M is quite trivial. Given M and e, solving for E can prove quite difficult. In fact this problem is considered transcendental, meaning E can not be represented as a finite set of algebraic terms of e and M. As such this problem is almost always solved using some numerical method.
For this assignment please create a function called kepler_yourlastname (yes, that is an underscore in between kepler and yourlastname, no spaces). So, when kepler_yourlastname is run, it solves the Kepler equation for E given e and M (your function should accept M and e as inputs, and return E). The actual solution should be performed using the MATLAB built in function fzero() to solve the following form of Kepler's equation:
0 = E - e*sin[E] – M
We use this form because fzero solves for roots of the input function. Recall that fzero() is a function function, and that it that it expects that the function argument which you pass it will only accept one argument. This means that fzero(f(x)) is acceptable, but fzero(f(x,y)) is not. As such you might find it useful to use the shared workspace property of nested functions to your advantage to complete this assignment.
Please plot E vs. M for eccentricities (e) of the Earth, Pluto, 17P/Holmes, 19P Borrelly, 21P Giacobini-Zinner, and 1P/Halley's Comet. Please include all curves in 1 figure axis, each with a different color and line style. You must label your axes and include a legend. Finally, output a table with headings.
Explanation / Answer
Start with :
%it solves the Kepler equation for E
%given e and M (your function should accept M and e as inputs, and return E)
. %The actual solution should be performed using the MATLAB built in
%function fzero() to solve the following form of Kepler's equation:
%0 = E - e*sin[E] – M
function E = kepler(M, e)
f=@(E) E-e*sin(E)-M;
E=fzero(f,0);
%E = eccentric anomaly measured from perihelion about %the center of the elliptical orbit %M = mean anomaly = 2p t/P
M=(0:0.01:6);
N=length(M);
%e = eccentricity of the orbit
e=[0 0.25 0.5 0.75 1];
n=length(e); for x=1:N for y=1:n
end
figure, plot(M,E), grid on,