Set time reference for incoming samples

3 次查看(过去 30 天)
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

回答(1 个)

Jan
Jan 2017-8-4
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 个评论
Jan
Jan 2017-8-4
编辑:Jan 2017-8-4
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 2017-8-4
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Coexistence Modeling 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by