day and night from lat, long, time?

9 visualizaciones (últimos 30 días)
Nina Schuback
Nina Schuback el 5 de Abr. de 2020
Respondida: Meysam Mahooti el 26 de Mayo de 2021
I have a vector of latitude, and vector of longitude, and a vector of UTC time.
Is there a simple way to determine whether or not it is day or night at each point? Just a simple 0,1 kind of answer?
  1 comentario
James Tursa
James Tursa el 5 de Abr. de 2020
Convert it to a pointing vector and then find the angle between that and the Sun pointing vector. Do you have a Sun position function?

Iniciar sesión para comentar.

Respuesta aceptada

Nina Schuback
Nina Schuback el 7 de Abr. de 2020
Thank you for the replies!
I ended up using the sunsetsunrise.m function which gives me sunset and sunrise in UTC!

Más respuestas (2)

Ameer Hamza
Ameer Hamza el 5 de Abr. de 2020
If you have the Mapping toolbox, you can use timezone(): https://www.mathworks.com/help/map/ref/timezone.html to find the hour offset from the UTC given the longitude value.
From the offset value, you can convert the UTC to the local time and based on your threshold, whether it is day or night. Or you can also use datetime() function to convert the UTC to the local time.

Meysam Mahooti
Meysam Mahooti el 26 de Mayo de 2021
https://www.mathworks.com/matlabcentral/fileexchange/60157-sunrise-sunset?s_tid=srchtitle

Categorías

Más información sobre Dates and Time en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by