Effacer les filtres
Effacer les filtres

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

10 vues (au cours des 30 derniers jours)
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

Réponse acceptée

Les Beckham
Les Beckham le 25 Oct 2023
Modifié(e) : Les Beckham le 25 Oct 2023
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 commentaires
Voss
Voss le 25 Oct 2023
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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by