Plotting E - e*sin[E] = M as E vs M, when given e as 5 different values [0 0.25 0.5 0.75 1]?

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 :)

回答 (2 件)

Walter Roberson
Walter Roberson 2013 年 9 月 12 日

0 投票

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()

4 件のコメント

Daniel
Daniel 2013 年 9 月 12 日
How would something like that look as far as mat lab coding? I get what you are saying, but I am not seeing how I would code that.
Another hint: to loop over values of M, use the 'for' statement. See the examples contained in:
doc for
Daniel
Daniel 2013 年 9 月 12 日
Also they have to be shown as five different curves on the same graph, but I know if you plotted each separately for e value given then E vs M and use "Hold on" command that would work.
Duy Nguyen
Duy Nguyen 2013 年 9 月 29 日
I have the same problems too, how can you graph E vs. M for e of values [0 0.25 0.5 0.75 1] with 5 curves in 1 figure?

サインインしてコメントする。

Youssef  Khmou
Youssef Khmou 2013 年 9 月 30 日
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,

カテゴリ

ヘルプ センター および File ExchangeTime Series Events についてさらに検索

質問済み:

2013 年 9 月 12 日

回答済み:

2013 年 9 月 30 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by