Set time reference for incoming samples

조회 수: 10 (최근 30일)
Lask
Lask 2017년 8월 4일
댓글: Lask 2017년 8월 4일
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
Jan
Jan 2017년 8월 4일
Are you working under Windows, Mac or Linux?
Lask
Lask 2017년 8월 4일
Windows 7

댓글을 달려면 로그인하십시오.

답변 (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