フィルターのクリア

how to convert absolute time to real time and calculate the sampling rate

10 ビュー (過去 30 日間)
NGR MNFD
NGR MNFD 2023 年 10 月 25 日
コメント済み: NGR MNFD 2023 年 10 月 26 日
Hello to all...In this file, I have the absolute time and date and day of data registration. Now I want to get the real time and calculate the sampling rate from the difference of the frames with each other and their inverse. I have a problem with the MATLAB code. In the first step, I don't know how to calculate the real time and do the next steps? Help me please. Thanks a lot

採用された回答

Les Beckham
Les Beckham 2023 年 10 月 25 日
編集済み: Les Beckham 2023 年 10 月 25 日
load metaData_Depth
fn = @(s) datetime(s.AbsTime);
dt = arrayfun(fn, metaData_Depth)
dt = 150×1 datetime array
21-Oct-2023 13:51:49 21-Oct-2023 13:51:49 21-Oct-2023 13:51:49 21-Oct-2023 13:51:49 21-Oct-2023 13:51:50 21-Oct-2023 13:51:50 21-Oct-2023 13:51:52 21-Oct-2023 13:51:52 21-Oct-2023 13:51:52 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:54 21-Oct-2023 13:51:54 21-Oct-2023 13:51:54 21-Oct-2023 13:51:54 21-Oct-2023 13:51:54 21-Oct-2023 13:51:54 21-Oct-2023 13:51:54 21-Oct-2023 13:51:54
delta_t = seconds(diff(dt))
delta_t = 149×1
0.0209 0.0315 0.0631 0.1337 0.1658 2.5103 0.0901 0.1112 0.2360 0.0295
max(delta_t)
ans = 2.5103
min(delta_t)
ans = 0.0162
numel(unique(delta_t))
ans = 149
mean(delta_t)
ans = 0.0939
std(delta_t)
ans = 0.2075
plot(delta_t, '.')
grid on
So, every single sample has a different duration of time between it and the next sample. Thus, it isn't going to make much sense to calculate a sample rate for this data.
  7 件のコメント
Voss
Voss 2023 年 10 月 25 日
load metaData_Depth
C = num2cell(vertcat(metaData_Depth.AbsTime),1);
dt = datetime(C{:})
dt = 150×1 datetime array
21-Oct-2023 13:51:49 21-Oct-2023 13:51:49 21-Oct-2023 13:51:49 21-Oct-2023 13:51:49 21-Oct-2023 13:51:50 21-Oct-2023 13:51:50 21-Oct-2023 13:51:52 21-Oct-2023 13:51:52 21-Oct-2023 13:51:52 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:53 21-Oct-2023 13:51:54 21-Oct-2023 13:51:54 21-Oct-2023 13:51:54 21-Oct-2023 13:51:54 21-Oct-2023 13:51:54 21-Oct-2023 13:51:54 21-Oct-2023 13:51:54 21-Oct-2023 13:51:54
delta_t = dt - dt(1)
delta_t = 150×1 duration array
00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:02 00:00:03 00:00:03 00:00:03 00:00:03 00:00:03 00:00:03 00:00:03 00:00:03 00:00:03 00:00:03 00:00:03 00:00:03 00:00:03 00:00:03 00:00:04 00:00:04 00:00:04 00:00:04 00:00:04 00:00:04 00:00:04 00:00:04 00:00:04
NGR MNFD
NGR MNFD 2023 年 10 月 26 日
tnx very much.

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by