localTime = datetime
01-Jun-2019 12:00:00
To calculate the sun's position for a given date and time, use solar time. Twelve noon solar time is the
time when the sun is highest in the sky. To calculate solar time, apply a correction to local time. That
correction has two parts:
• A term which corrects for the difference between the observer's location and the local meridian.
• An orbital term related to the earth's orbital eccentricity and axial tilt.
Calculate solar time using the solarCorrection function.
d = caldays(between(january1,localTime,'Day'));
% Day of year
solarCorr = solarCorrection(d,lambda,str2double(UTCoff));
% Correction to local time
solarTime = localTime + minutes(solarCorr)
solarTime = datetime
01-Jun-2019 12:18:15
Solar Declination and Elevation
Include equations to describe the underlying mathematics. Create equations using LaTeX commands.
To add a new equation, go to the Insert tab and click the Equation button. Double-click an equation
to edit it in the Equation Editor.
The solar declination (δ) is the angle of the sun relative to the earth's equatorial plane. The solar
declination is 0
∘ at the vernal and autumnal equinoxes, and rises to a maximum of 23 . 45
∘ at the
summer solstice. Calculate the solar declination for a given day of the year (d) using the equation
δ = sin
−1 sin(23 . 45)sin
360
365
(d − 81)
Then, use the declination (δ), the latitude (ϕ), and the hour angle (ω) to calculate the sun's elevation
(α) at the current time. The hour angle is the number of degrees of rotation of the earth between the
current solar time and solar noon.
α = sin
−1 sinδsinϕ + cosδcosϕcosω
delta = asind(sind(23.45)*sind(360*(d - 81)/365));
% Declination
omega = 15*(solarTime.Hour + solarTime.Minute/60 - 12);
% Hour angle
alpha = asind(sind(delta)*sind(phi) + ...
% Elevation
cosd(delta)*cosd(phi)*cosd(omega));
disp(['Solar Declination = ' num2str(delta) '
Solar Elevation = ' num2str(alpha)])
Solar Declination = 21.8155
Solar Elevation = 69.113
Calculate the time of sunrise and sunset in Standard Time using the sun's declination and the local
latitude.
sunrise = 12 −
cos −1 − tanϕtanδ
15
∘
−
TC
60
sunset = 12 +
cos −1 − tanϕtanδ
15
∘
−
TC
60
midnight = dateshift(localTime,'start','day');
sr = 12 - acosd(-tand(phi)*tand(delta))/15 - solarCorr/60;
Create an Interactive Narrative with the Live Editor
19-71
Précédent

- 689/1450

Suivant