- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我需要在 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,此函数在本应为 06:09 时为我提供了 05:51:25 的日出,在本应为 18:22 时为我提供了 18:02:21 的日落。 (美国国家海洋和大气局)。
函数是基于这个开发的:https://www.mathworks.com/matlabcentral/fileexchange/55509-sunrise-sunset/content/SunriseSunset.mlx
我可以做些什么来提高准确性并从 ESRL (NOAA) 获得相同的值?
最佳答案
你在这里把苹果和橙子混在一起了!
您使用的公式是计算实际日出和日落(几何)。
NOAA website给出表观日出和日落。这些值已针对大气折射进行了校正!
在the glossary to the NOAA website , 它是这样写的:
Due to atmospheric refraction, sunrise occurs shortly before the sun crosses above the horizon. Light from the sun is bent, or refracted, as it enters earth's atmosphere. See Apparent Sunrise Figure. This effect causes the apparent sunrise to be earlier than the actual sunrise. Similarly, apparent sunset occurs slightly later than actual sunset.
所以这正是您观察到的计算错误的影响。
如果你真的想计算明显的日出和日落,引用Solar Calculation Details来自 NOAA 本身或 this SO answer .但请注意:“……这很复杂!”
编辑:请参阅我的其他答案,了解在 MatLab 中计算明显日出和日落的精确函数
关于matlab - 如何计算日出和日落时间(matlab)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42934300/
我正在尝试使用 pyephem 计算日出和日落,但该算法似乎从未在极地地区收敛? 观察下面的示例代码。它以 10 分钟为增量迭代一整年,询问下一次日出和日落。 pyephem 总是返回一个 Alway
我正在制作一个 Android 应用程序,它获取用户位置的坐标,然后使用这些坐标与以下提供的 REST API 进行通信: this website 我对 JSON 解析和 REST API 相当陌生
这个问题已经有答案了: Using the date from DatePicker in URL for webservice (1 个回答) 已关闭10 年前。 好的,所以我被困住了,需要一些帮助
我是一名优秀的程序员,十分优秀!