File Exchange

image thumbnail

Moon Phases

version (16.4 MB) by Meysam Mahooti
Determination of lunar phases and checking for eclipses


Updated 19 Mar 2019

View License

Input: year
Output: phases of the Moon and time of lunar eclipses are specified.
Montenbruck O., Pfleger T.; Astronomy on the Personal Computer; Springer Verlag, Heidelberg; 4th edition (2000).
Meeus J.; Astronomical Algorithms; Willmann-Bell; Richmond, Virginia; 2nd edition (1998).

Cite As

Meysam Mahooti (2020). Moon Phases (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (9)

The full matrix is not available anymore via the researchgate link, is it possible to add it to the file exchange instead of an external link?

Dear Jicai Zhang,
DE430Coeff.mat full matrix is now available in the following link:
Use it rather than existing DE430Coeff.mat matrix and get what you like!
Yours Faithfully
Meysam Mahooti

Jicai Zhang

I Love it!Thanks. Except it probably can not calculate the years before 1949 or after 2049.


Better to have the year as an input, as follows:
Year= input (' Select the year: ');
Remarks: outputs for year 1972 work _properly_, despite the note of WB Buddendorf user.

This is a handy tool. However, the script enters an infinite loop in certain years. For example, in 1972 when it's determining the timing for the full moon, the script stops running. It seems this happens in the 'Pegasus' function where some of the variables (x3 first, other later on in the script) get NaN values. Is there a possibility to work around this? Tried changing the accuracy but doesn't seem to achieve much...


ETminUT.m is updated to cover more years considering you are using DE430Coeff.mat full matrix from

ETminUT.m is revised and JPL Development Ephemeris (DE430) are used for computation of the Sun and the Moon positions in PhasesFunc.m.

Revised on 2017-03-05.

The image is added.

MATLAB Release Compatibility
Created with R2012b
Compatible with any release
Platform Compatibility
Windows macOS Linux