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

10 ビュー (過去 30 日間)
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 2023 年 10 月 25 日

fn = @(s) datetime(s.AbsTime);
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 件のコメント5 件の古いコメントを表示5 件の古いコメントを非表示
Voss 2023 年 10 月 25 日
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 2023 年 10 月 26 日
tnx very much.

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

### カテゴリ

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