forked from poliastro/validation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dayofwee.m
38 lines (34 loc) · 1.09 KB
/
dayofwee.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
% -----------------------------------------------------------------------------
%
% function dayofwee
%
% this function finds the day of the week. integers are used for the days,
% 1 = 'sun', 2 = 'mon', ... 7 = 'sat'.
%
% author : david vallado 719-573-2600 27 may 2002
%
% revisions
% -
%
% inputs description range / units
% jd - julian date of interest days from 4713 bc
%
% outputs :
% dayofweek - answer 1 to 7
%
% locals :
% none.
%
% coupling :
% none.
%
% references :
% vallado 2007, 188, eq 3-39
%
% dayofweek = dayofwee(jd);
% -----------------------------------------------------------------------------
function dayofweek = dayofwee(jd);
% ------------------------ implementation ------------------
% ------- be sure jd is at 0.0d0 h on the day of interest -----
jd = floor(jd + 0.5);
dayofweek = fix( jd - 7 * fix( (jd+1)/7 ) + 2 );