-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutc2gmst.m
40 lines (36 loc) · 1.31 KB
/
utc2gmst.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
39
40
function gmst = utc2gmst(date1)
%% DESCRIPTION
%
% Written by: Tyler Reid ([email protected])
% PI: Todd Walter, Per Enge
% Lab: Stanford University GPS Lab
% Project Title: Arctic Navigation / WAAS
% Project Start Date: March 28, 2011
% Last updated: April 19, 2011
%
% -------------------------------------------------------------------------
% FUNCTION DESCRIPTION
%
% Given the UTC date / time compute the Greenwich Mean Sidereal Time in
% radians. This algorithm is based on Vallado (2007) p. 195.
%
% -------------------------------------------------------------------------
% INPUT:
%
% date1 = date / time vector UTC.
%
% -------------------------------------------------------------------------
%
% OUTPUT:
%
% GMST = Greenwich Mean Sidereal Time [rad]
%
%% IMPLEMENTATION
% Compute the Julian date for the given input date vector.
JD = juliandate(date1);
% Compute UT1.
UT1 = (JD-2451545.0)/36525;
% Compute the Greenwich Mean Sidereal Time (GMST) [seconds].
gmst = 67310.54841 + (876600*3600 + 8640184.812866)*UT1 + 0.093104*UT1^2 - 6.2e-6*UT1^3;
% Convert GMST to radians and put in the range [0 2*pi].
gmst = mod((gmst/240)*pi/180,2*pi);