day and night from lat, long, time?
8 次查看(过去 30 天)
显示 更早的评论
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 个评论
James Tursa
2020-4-5
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?
采纳的回答
更多回答(2 个)
Ameer Hamza
2020-4-5
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.
0 个评论
Meysam Mahooti
2021-5-26
https://www.mathworks.com/matlabcentral/fileexchange/60157-sunrise-sunset?s_tid=srchtitle
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!