如何对两个信号进行同步/同步?

时间:2017-01-20 11:43:20

标签: matlab data-synchronization

我有两个信号A和B(请参见附件),它们是在同一事件中从不同采样频率的不同设备录制的。

我试图通过互相关方法对齐两个信号。但是,当使用alignignals函数时,它似乎实际上延迟了更多的信号:

load A 
load B

% Sampling frequencies
Fs_A = 1000; % 
Fs_B = 1926; % 1925.93 Hz is the one provided by the device

% Resample signal A
A = resample(A, Fs_B, Fs_A);

% Plot of the two signals "delayed"
figure(1)
plot(A)
hold
plot(B*1000)

% Aling both signals
X = A; 
Y = B;

[Xa,Ya,D] = alignsignals(X,Y,[],'truncate');
figure(2) % plot both signals "aligned" 
plot(Xa)
hold
plot(Ya*1000)

我也尝试过使用xcorr功能,结果相似:

load A 
load B

% Sampling frequencies
Fs_A = 1000; % 
Fs_B = 1926; % 1925.93 Hz is the one provided by the device

% Resample signal A
A = resample(A, Fs_B, Fs_A);

% Plot to visualize that one signal is delayed 
figure(1)
plot(A)
hold
plot(B*1000)

% Aling both signals using xcorr

[C,lag] = xcorr(A,B);
figure(2)
plot(lag,C);
[M,I] = max(C);
D = lag(I);
figure(3),plot(1:length(A), A, 'b',1+abs(D):length(B)+abs(D), B*1000, 'r'), title(' "Synchronised" signals ');

我犯了什么错误吗?

谢谢

0 个答案:

没有答案