Debugging
8 views (last 30 days)
Show older comments
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
Accepted Answer
Sean de Wolski
on 23 Apr 2012
kepler(exp(1),4)
kepler(exp(1),magic(4))
works for me...
6 Comments
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.
More Answers (0)
See Also
Categories
Find more on Earth, Ocean, and Atmospheric Sciences in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!