The sunpos function returns the sun position according to DIN EN 17037 from UTC (Coordinated Universal Time). 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.


[az,el] = sunpos(date,utc,geolength,geowidth)

Note: For current sun position, use an empty function call and adapt the default geographic coordinates in the function file:

[az,el] = sunpos()


az & elReturns the solar azimuth and elevation angles.
dateSpecifies the date in '' format, default: current day.
utcSpecifies the UTC time in 'hh:mm:ss' format, default: current time.
geolengthSpecifies the geographic length, default: 13.326 (Berlin). You can change the preference in the “LT_location.mat” file.
geowidthSpecifies the geographic width, default: 52.514 (Berlin). You can change the preference in the “LT_location.mat” file.


Sun position in Berlin at ‘21.05.1987’ – ’11:03:22 UTC:

[az,el] = sunpos('21.05.1987','11:03:22')


az = 180.00
el = 57.527

Note: to determine noon UTC time, use the south function.

Sun position in Athens at ‘21.05.1987’ – ’11:03:22 UTC:

[az,el] = sunpos('21.05.1987','11:03:22',37.978,23.728)


az = 265.64
el = 66.859


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

Leave a comment

* I accept the use of cookies as well as the terms in the privacy policy. I accept that data provided by me is processed and saved. I know that comments are saved and published after review.