Year, month, day, lambda (Geographic east longitude of the observer in [deg]), phi (Geographic latitude of the observer in [deg]), zone (local time - universal time in [h]) and twilight (Indicates civil, nautical or astronomical twilight) are received, then rising and setting times of Sun and Moon and twilight times are computed.
Moon and Sun positions are computed using JPL ephemerides (DE430).
Meysam Mahooti (2021). Sunrise Sunset (https://www.mathworks.com/matlabcentral/fileexchange/55312-sunrise-sunset), MATLAB Central File Exchange. Retrieved .
DE430Coeff.mat full matrix is now available in the following link:
Use it with my Sunrise Sunset (version 188.8.131.52) which doesn't need Earth Orientation Parameters. You know in https://celestrak.com/SpaceData/
you can get access to EOP data which are predicted just for a few months later. As a result, for prediction purposes we use estimated matrix for coordinate transformations. Some people ask me why I use Mjday_UTC rather than Mjday_TDB and the answer is the same; because we don't have an accurate and reliable formula for prediction of UT1-UTC, LOD and so on.
This program is very useful. It is well commented so that those unfamiliar with the terms can easily relate variables commonly used (latitude, longitude, date) to those as "lambda". Being able to have the sunrise and sunset time in UTC and not needing local time is another asset for open ocean applications.
When one is stumbling around on the net, it can be as an in a fog trying to locate something, especially when technical terms are used and/or if hidden by layers of menus that are easily navigated only by insiders with experience.
I came across this sunrise/sunset program only on account of not finding anything useful before and by trying the Matlab help. I am grateful for Matlab having this venu and for Meysam Mahooti for submitting this. Thanks for both for getting across this gap quickly.
May I add that I have had works reviewed by others. I especially appreciate it when those who find fault with my stuff express their view using languate that is moderate and not sharp. Science is best served by polite presentations of ones thoughts..
The code of the functions has been published by someone else. E.g. Ast_Const.m is a 1-to-1 copy of the C-codes found at http://extras.springer.com/2000/978-3-540-67221-0/APCe/Source/APC_Const.h and in the book "Astronomy on the Personal Computer" of Oliver Montenbruck,Thomas Pfleger (Springer). Meysam Mahooti has inserted his name as author and removed the original copyright notice:
// This software is protected by national and international copyright.
// Any unauthorized use, reproduction or modificaton is unlawful and
// will be prosecuted. Commercial and non-private application of the
// software in any form is strictly prohibited unless otherwise granted
// by the authors.
// (c) 1999 Oliver Montenbruck, Thomas Pfleger
Plagiarism is not a trivial offense in science.
You need to extend PC matrix using the following code (I cannot upload files more than 20 MB):
PC matrix is described here:
Please pay attention to format of DE files which are explained in this link:
I'm getting error for dates prior to December 10, 1959, but this set of functions works great after that. Any suggestions? I'm trying to use this function to identify astronomical twilight from some historical research cruises off California.
This set of functions is great. The only problem I'm running into is that the eop19620101.txt file stops at the end of 2019. Would it be possible to extend this for a longer period of time? Or where can I find this information to extend it myself? Thanks!
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!