Debugging

8 views (last 30 days)
Kristy
Kristy on 23 Apr 2012
function E = kepler (e, M)
% E = kepler(e, M)
% Solves kepler's equation for E, the eccentric anomoly given
% e, the orbital eccentricity and M, the mean anomoly.
for i = 1:length(M)
E(i) = fzero(@func, 1);
end
function out = func(E)
out = E - e*sin(E)-M(i);
end
end
the goal is to solve keplers equation using the zero function but I keep getting Error messages in return
  1 Comment
Sean de Wolski
Sean de Wolski on 23 Apr 2012
What error messages?

Sign in to comment.

Accepted Answer

Sean de Wolski
Sean de Wolski on 23 Apr 2012
kepler(exp(1),4)
kepler(exp(1),magic(4))
works for me...
  6 Comments
Kristy
Kristy on 23 Apr 2012
ok I will try this
Jan
Jan on 23 Apr 2012
Two standard suggestions:
1. Such basic questions are explained exhaustively in the Getting Started chapters of the documentation.
2. Whenever you post in this forum, that you get an error message, include the complete message also. Matlab's error messages are really helpful in 99.9% of the cases.

Sign in to comment.

More Answers (0)

Categories

Find more on Earth, Ocean, and Atmospheric Sciences in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!