Set time reference for incoming samples
조회 수: 10 (최근 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
댓글 수: 2
답변 (1개)
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
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Coexistence Modeling에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!