【发布时间】:2017-03-21 17:32:20
【问题描述】:
我需要在 Matlab 中计算日出和日落时间,但我找不到正确(且简单)的方法。
我需要获得与以下内容相同的结果:
https://www.esrl.noaa.gov/gmd/grad/solcalc/ 和 http://sunrise-sunset.org/api
我已经尝试根据https://en.wikipedia.org/wiki/Sunrise_equation和http://www.wikihow.com/Estimate-the-Time-of-Sunrise-or-Sunset这几篇文章实现一个功能,但是结果是错误的。 (也许我做错了什么)
我还在 Matlab 中开发了一个似乎更准确的脚本,但我仍然没有得到确切的日出和日落时间:
% Parameters definition
lat = -23.545570; % Latitude
lng = -46.704082; % Longitude
UTCoff = -3; % UTC offset
nDays = daysact('01-jan-2017', '15-mar-2017'); % Number of days since 01/01
% Longitudinal correction
longCorr = 4*(lng - 15*UTCoff);
B = 360*(nDays - 81)/365; % I have no idea
% Equation of Time Correction
EoTCorr = 9.87*sind(2*B) - 7.53*cosd(B) - 1.5*sind(B);
% Solar correction
solarCorr = longCorr - EoTCorr;
% Solar declination
delta = asind(sind(23.45)*sind(360*(nDays - 81)/365));
sunrise = 12 - acosd(-tand(lat)*tand(delta))/15 - solarCorr/60;
sunset = 12 + acosd(-tand(lat)*tand(delta))/15 - solarCorr/60;
sprintf('%2.0f:%2.0f:%2.0f\n', degrees2dms(sunrise))
sprintf('%2.0f:%2.0f:%2.0f\n', degrees2dms(sunset))
根据ESRL (NOAA),这个函数给了我 05:51:25 的日出,它应该是 06:09,日落是 18:02:21,它应该是 18:22。
函数就是基于这个开发的:https://www.mathworks.com/matlabcentral/fileexchange/55509-sunrise-sunset/content/SunriseSunset.mlx
我可以做些什么来提高准确性并从 ESRL (NOAA) 获得相同的值?
【问题讨论】:
标签: matlab