image thumbnail

Moon Position

version 1.1.0.0 (18.1 KB) by James Tursa
moonpos calculates moon position accurate to 10 arcsec. Based on Astronomical Algorithms, Meeus

2.9K Downloads

Updated 01 Aug 2009

View License

moonpos calculates the moon position using the method in the book
Astronomical Algorithms by Jean Meeus, Chapter 45, pp 307 - 313. The
algorithm used is accurate to about 10 arcsec in longitude and 4 arcsec
in latitude according to the book, although the time range is not
mentioned. The periodic terms used in this algorithm are based on the
Chapront ELP-2000/82 lunar theory, including the later improvements by
Chapront. The results of this theory are referred to the mean equinox
of date, but moonpos converts these to the apparent geocentric position
of the moon referred to the true equinox of date.

Syntax

B = moonpos(A)
B = moonpos(A,S1)
B = moonpos(A,S1,S2,...)

Description

A = a Nx1 double vector containing the date values. By default, the data
is expected to be in Serial Date Number format, but this can be
changed to Julian Day, Modified Julian Day, Reduced Julian Day, or
Truncated Julian Dat with optional strings (see below).

= a Nx6 double date matrix, where each row is a full date vector
specifying year, month, day, hours, minutes, seconds in that order.
Dates must be compatible with the MATLAB datenum function.

= a Nx3 double date matrix, where each row is a partial date vector
specifying year, month, and day in that order. Dates must be
compatible with the MATLAB datenum function.

= a NxM character array containing dates that are compatible with the
datenum function.

For the last three cases the datenum function is called automatically
by moonpos to convert the dates to SDN format.

B = a NxM double vector containing the moon position data. By default a
Nx3 vector is returned where the three columns are right ascension (rad),
declination (rad), and distance (km), but this can be changed with
optional strings (see below). Output is true-of-date from earth
center.

Sn = Optional string argument(s) that alter input and output settings. You
can specify more than one optional string. They are processed left to
right and are case insensitive. If you specify mutually exclusive
options (such as 'jd' and 'rjd'), the rightmost option will prevail.

'julian' or 'julian day' or 'jd'
= Input vector A is in Julian Day format. i.e., the interval of time
in days and fractions of a day since January 1, 4713 BC Greenwich noon

'reduced julian day' or 'reduced' or 'rjd'
= Input vector A is in Reduced Julian Day format, RJD = JD - 2400000.

'modified julian day' or 'modified' or 'mjd'
= Input vector A is in Modified Julian Day format, MJD = JD - 2400000.5

'truncated julian day' or 'truncated' or 'tjd'
= Input vector A is in Truncated Julian Day format, TJD = JD - 2440000.5

'radec'
= Output is Nx3 matrix in right ascension, declination, distance format
in units of radians, radians, kilometers (this is the default).
But note that you can change the units of the angles or distance
(see below), and you can add the x, y, z cartesian output at the
same time with the 'xyz' option and get a Nx6 matrix result.

'xyz'
= Output is Nx3 matrix with x, y, z cartesian coordinates. Note
that this can be specified in addition to 'radec' if you want
a Nx6 matrix output with both data sets present. The order in
which the 'radec' and 'xyz' options appear in the argument list
determines the order in which the output appears in the result.

'feet' or 'ft'
= Output distances will be in feet instead of km.

'meter' or 'meters' or 'm'
= Output distances will be in meters instead of km.

'degree' or 'degrees' or 'deg'
= Output angles will be in degrees instead of radians.

'hms'
= Output right ascension will be in hh.mmsss... format.

'dms'
= Output declination will be in dd.mmsss... format.

'nutationlow'
= Use the slightly lower precision nutation formulae at the bottom
of page 132 instead of the full TABLE 21.A terms.

Examples

Several examples are given in the included file moonpos_examples.m

Cite As

James Tursa (2021). Moon Position (https://www.mathworks.com/matlabcentral/fileexchange/23475-moon-position), MATLAB Central File Exchange. Retrieved .

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

Community Treasure Hunt

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

Start Hunting!