File Exchange

image thumbnail

Sunrise Sunset

version 1.1.1.0 (18 MB) by Meysam Mahooti
Rising and setting times of Sun and Moon and twilight times

19 Downloads

Updated 17 Mar 2020

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

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).

Cite As

Meysam Mahooti (2020). Sunrise Sunset (https://www.mathworks.com/matlabcentral/fileexchange/55312-sunrise-sunset), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (13)

Meysam Mahooti

Dear Rebecca,

DE430Coeff.mat full matrix is now available in the following link:
https://www.researchgate.net/publication/331821512_JPL_Planetary_and_Lunar_Ephemerides_DE430_full_MATLAB_matrix
Use it with my Sunrise Sunset (version 2.0.0.0) 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.

Yours Faithfully
Meysam Mahooti

Clive Dorman

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..

Ellyn Gray

Jan

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.

Meysam Mahooti

Dear Rebecca,
You need to extend PC matrix using the following code (I cannot upload files more than 20 MB):
https://www.mathworks.com/matlabcentral/fileexchange/64815-jpl-planetary-and-lunar-ephemerides
PC matrix is described here:
https://www.mathworks.com/matlabcentral/fileexchange/60504-nasa-jpl-developement-ephemerides--de430-
Please pay attention to format of DE files which are explained in this link:
http://ssd.jpl.nasa.gov/?planet_eph_export

Rebecca

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.

Tetiana Lytvynenko

NenaV

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!

Michael Sampol

peter anderson

terry moore

Demi Moore

Sam Davidson

Updates

1.1.1.0

Revised on March 17, 2020.

1.1.0.0

The image is added.

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