Asked by Daniel
on 12 Sep 2013

For a question in my homework , we are suppose to first find the fzeros of this function of E when given any values of e, and M. I already figured this out by the following:

function [ E,z ] = kepler( e,M ) %UNTITLED Summary of this function goes here % Detailed explanation goes here f=@(E) E-e*sin(E)-M; z=fzero(f,0)

But I cannot for the life or me figure out how I would plot this E vs M when only given a value of e. If anyone can help me out that would be greatly appreciated :)

Answer by Walter Roberson
on 12 Sep 2013

The usual way: loop over all the potential values of M for a fixed e, recording the outcome each time. Plot the potential values of M on one axis, and the recorded E values on another axis.

hint: ndgrid(), arrayfun(), and surf()

Matt Kindig
on 12 Sep 2013

Another hint: to loop over values of M, use the 'for' statement. See the examples contained in:

doc for

Daniel
on 12 Sep 2013

Duy Nguyen
on 29 Sep 2013

Log in to comment.

Answer by Youssef Khmou
on 30 Sep 2013

Daniel, i find this issue not clear at all, besides you have to to give some Physical explanations about the constants, M as **mean anomaly** ,e as **eccentricity** :

function [ E] = kepler( e,M ) f=@(E) E-e*sin(E)-M; E=fzero(f,0); ------------------------------ M=(0:0.01:6); N=length(M); e=[0 0.25 0.5 0.75 1]; n=length(e); for x=1:N for y=1:n E(x,y)=kepler(e(y),M(x)); end end figure, plot(M,E), grid on,

Log in to comment.

Opportunities for recent engineering grads.

Apply Today
## 0 Comments

Log in to comment.