Set time reference for incoming samples

3 visualizaciones (últimos 30 días)
Lask
Lask el 4 de Ag. de 2017
Comentada: Lask el 4 de Ag. de 2017
Hi all,
I have a system consisting in multiple Bluetooth devices that send samples to Matlab at a specific rate. Since I'm using wireless communications, not every sample from every device will arrive to Matlab at the exact same time. So my aim is to use a Matlab clock reference to "align" the samples sent from every Bluetooth device so I can plot them using the same time axis.
At the end I must be able to store the samples this way (table shows the arrival time of 3 samples from each device)
| Matlab time reference | BT device 1 | BT device 2 | BT device 3 |
| 1 ms | 1.1 ms | 1.12 ms | 1.09 ms |
| 2 ms | 2.01 ms | 2.09 ms | 2.1 ms |
| 3 ms | 3.03 ms | 3.11 ms | 3.1 ms |
I thought about using Matlab "clock" function, which provides date and time with 4 decimal digits of precission, but I'd like to know if there's a more appropriate method.
Thanks in advance,
Edu
  2 comentarios
Jan
Jan el 4 de Ag. de 2017
Are you working under Windows, Mac or Linux?
Lask
Lask el 4 de Ag. de 2017
Windows 7

Iniciar sesión para comentar.

Respuestas (1)

Jan
Jan el 4 de Ag. de 2017
Under Windows and Linux see: https://www.mathworks.com/matlabcentral/fileexchange/16534-high-accuracy-timer for a high accuracy timer. I'm not sure if it works under Mac also.
  3 comentarios
Jan
Jan el 4 de Ag. de 2017
Editada: Jan el 4 de Ag. de 2017
Your data
| 2 ms | 2.01 ms | 2.09 ms | 2.1 ms |
looks like you need a resolution with at least 0.01 miliseconds.
It is very easy to compile the C file and use it like any other Matlab function. In addition clock replies the time with miliseconds precision already. Therefore I'm not sure what your statement "provides date and time with 4 decimal digits of precission" means. See:
c = clock;
c(6)
The question is, how meaningful these miliseconds are, because neither Matlab nor Windows is a real time systems and the execution of this command can take more than a few miliseconds already - if the OS starts a hard disk defragmentation or the memory is exhausted this can be seconds also.
Lask
Lask el 4 de Ag. de 2017
The idea is I need a way to detect every 2 ms increment in a clock reference so I can align the samples from all devices in time. I think clock function from Matlab is not very appropiate.

Iniciar sesión para comentar.

Categorías

Más información sobre Coexistence Modeling en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by