image thumbnail


version 2.0.0 (9.54 KB) by David Young
Shadow positions for a horizontal, vertical or tilted sundial


Updated 22 Jan 2022

View License

Given an array of times and the latitude of a sundial, the function computes the corresponding angles of the shadow on the dial.
The sundial may be at any orientation - both bearing and tilt may be specified - but there are simple argument sequences for the common cases of horizontal and vertical sundials.
The solar declination may be specified explicitly as an angle or as a date, or it may be allowed to default. The default is to use, for each time, a declination for which the dial is illuminated on some day of the year. Times for which the dial is not illuminated return NaN.
A longitude correction may be applied, and the time may also be specified as mean solar time (clock time).
The coordinates of the shadow of the tip of the gnomon may be returned as additional results.
The help information includes examples and an outline of the mathematical relations underlying the code.
The function uses an arguments block so will not run in releases earlier than R2019b.

Cite As

David Young (2022). sundial (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2021b
Compatible with R2019b and later releases
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

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

Start Hunting!