frudawski

# suntime

The suntime function calculates the Coordinated Universal Time (UTC) or local time for a given sun position and geographic location according to DIN EN 17037. The default geographical settings are set in the file “LT_location.mat”. Change the settings to your preferred location and set the file to read-only in order to prevent your settings from being overwritten with the default values in future versions.

Usage:

[utc,lct] = suntime(day,coord,target,value)

Where:

Examples

UTC for sun position \alpha = 90° at 13.05.2022 in Berlin:

utc = suntime('13.05.2022',[],'azimuth',90)

Result:

utc = 06:01:31

UTC and local time for sunset at 13.05.2022 in Berlin:

[utc,localtime] = suntime('13.05.2022',[],'sunset')

Result:

utc = 18:51:05
localtime = 20:51:05

UTC for sun positions \gamma_1 = 20° at 18.07.2021 in Athens:

utc = suntime('13.05.2022',[37.978 23.728],'gamma1',20)

Result:

utc = 14:26:51

Reference

DIN EN 17037:2019-03: Daylight in buildings. 2019.