how to convert GPS week and second of the week into UTC?

68 ビュー (過去 30 日間)
Imtiaz nabi
Imtiaz nabi 2022 年 2 月 17 日
コメント済み: Imtiaz nabi 2022 年 2 月 17 日
Hi there, I created a function that converts the gps time to utc time however, it is calculating the values wrong can anyone please check the values and let me know if I made a mistake somewhere?
g1 = 416705
g1 = 416705
g0 = 2197
g0 = 2197
c = floor(7*g1 + floor(g0/86400.0)+2444245.0) + 1537;
d = floor((c-122.1)/365.25);
e = floor(365*d + d/4);
f = int16((c-e)/30.6001);
d = c - e - int16(30.6001*f);
m = f - 1 - 12*(f/14);
kk=7+m;
k=floor(kk/10)-1;
y = d - 4715 - k;
hh = floor(mod((g0/3600.0),24));
mm = floor(mod((g0/60.0),60));
sec = g0 - 60.0*floor(g0/60.0);

回答 (1 件)

David Hill
David Hill 2022 年 2 月 17 日
  1 件のコメント
Imtiaz nabi
Imtiaz nabi 2022 年 2 月 17 日
First of all I am going to covert GPS time to UTC time while the above code is for UTC to GPST

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by