image thumbnail

sundial

version 2.4.0 (111 KB) by David Young
Shadow positions for a horizontal, vertical or tilted plane sundial taking into account times the dial is illuminated

14 Downloads

Updated 02 Feb 2022

View License

Given an array of times and the latitude of a plane sundial, sundial.m 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 never illuminated return NaN.
The time may be specified as either true solar time (normally used for laying out a sundial) or as mean solar time (clock time). A longitude correction may be applied.
The style (the shadow-casting edge of the gnomon) may be aligned with the celestial poles, as is usual, or may be perpendicular to the plane of the dial.
The coordinates of the shadow of the tip of the gnomon, and of the tip of the gnomon itself, may be returned as additional results.
The help information includes simple examples and an outline of the mathematical relations underlying the code. Fuller examples are in sundialExamples.m.
The function uses an arguments block so will not run in releases earlier than R2019b. The examples use name=value syntax so require R2021a or later.
Ancillary functions solarDeclination and equationOfTime are included.

Cite As

David Young (2022). sundial (https://www.mathworks.com/matlabcentral/fileexchange/105220-sundial), MATLAB Central File Exchange. Retrieved .

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

Community Treasure Hunt

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

Start Hunting!