Synchronization 3 vectors with different length and frequency

6 views (last 30 days)
Hi all, I am interested to understand how the synchronization works. I am searching for a solution and I saw more resolutive tools like crosscorrelation and other stuff. Till now I used interp1 and resample but I am not sure if my tecnique is correct.
I have three output signals A, B,C coming from 3 devices that are recording an event. The signals come with different sizes because the acquisitions started in different moments. Furthermore, the signal have 3 differents sample rates f_A[10^2] < f_B[10^2] < f_C[10^4].
The aim is to isolate the proper event for each signal (this means that I need the coordinate of start and end correlated to each length and frequency of each signal, i guess).
The condition is that I am able to identify the right frame of start and end event only from the signal B. I am quiete struggling to find the correct indices for vector A and C because i am not sure about how I am trying to solve it.
Data:
A=randn(1234,1);
B=randn(123456,1);
C=randn(123456789,1);
fsA=70;
fsB=150;
fsC=1800;
From B I reach 2 indices valid for B:
%output from B
.
.
output_B=[start finish];
From B I have to reach 2 indices valid for A. Can you tell me if theoretically is it reasonable?
%output from A
B=resample(B,fsB,fsA); % to sample B to the same frequency of A
B = (interp1(linspace(0,1,length(B)), B, (linspace(0,1,length(A)))))'; % to make equal length
.
.
output=[start finish]; %output valid for A
From B I have to reach 2 indices valid for C. And I am not sure if this is possible because of the Nyquist law (how can I solve it?) :
%output from C
B=resample(B,fsB,fsC); % to sample B to the same frequency of C
B = (interp1(linspace(0,1,length(B)), B, (linspace(0,1,length(C)))))'; % to make equal length
.
.
output=[start finish]; %output valid for C
I would like to understand how it has to be done because also the documentation and the various cases as upsample and downsampple creates in me some confusion.
Thanks in advance to everyboy who can help me.
  8 Comments
dpb
dpb on 2 Jun 2022
Ill-placed Answer from @DjangoTango pasted here in line as Comment by @dpb
@dpb Thank you, I think I understood you but not completely maybe. I ask you a little bit more patience. In my case I have not the right datetime of which each device started to record. I create it doing only:
timeA=0:1/fsA:(length(A)/fsA)-1
timeB=0:1/fsB:(length(B)/fsB)-1
timeC=0:1/fsC:(length(C)/fsC)-1
Am I talking of something that can not be done?
dpb
dpb on 2 Jun 2022
Edited: dpb on 3 Jun 2022
In that case, "Yes, we have no bananas today!"
If you do not have a trigger time for each (even a trigger delay would do, absolute clock time is immaterial and can be arbitrary), unless there is some way one can isolate a known to be simultaneous feature inside the waveforms themselves it's not possible to align the three.
If there were some known hardware latency that is inherent in the data acquisition setup that could be substituted instead or if the second and third are triggered from the first, then one could search for the trigger level crossing and assume that, but somehow will have to have that information to align the three, yes.
ADDENDUM:
Later thought -- I suppose if the three are started asynchronously, they're also stopped asynchronously? If you were lucky and the collection stopped simultaneously, then you could align from the end instead of the beginning. That would seem to be very unlikely to be the case, but when searching for a port in a storm...

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!