필터 지우기
필터 지우기

How to synchronize signals with bias

조회 수: 7 (최근 30일)
ArchLucs
ArchLucs 2019년 2월 21일
답변: Pooja Kumari 2024년 2월 8일
I have to synchronize two signals ('r' and 'e') affected by rumor, they have a relative offset and are not synchronized.
I applied a median moving filter to deal with the narrow high rumor spikes:
r = medfilt1(r, 10, 'includenan', 'truncate');
e = medfilt1(e, 10, 'includenan', 'truncate');
I tried to remove the bias with a workaround (the signals are constant the first 0.5s usually):
fs=1e3;
m_e = mean(e(1:fs/2));
m_r = mean(r(1:fs/2));
o = m_r - m_e;
r = r - o;
Lastly I have to time switching them. I tried the xcorr approach using the finddelay function:
>> d = finddelay(e, r)
d =
0
It doesn't work though. Any idea?

답변 (1개)

Pooja Kumari
Pooja Kumari 2024년 2월 8일
Hello,
As per my understanding, the finddelay function should not be returning 0 unless your signals 'r' and 'e' are already perfectly synchronized. It appears that the function is not working correctly for your particular signals, you can perform a manual cross-correlation by using the xcorr function to determine the time delay:
[acor, lag] = xcorr(e, r);
[~, I] = max(abs(acor));
time_delay = lag(I);
If time_delay is non-zero, this indicates the amount by which the signals need to be shifted to align them. If it is zero, but the signals are clearly not aligned, there may be an issue with the signals' content or the cross-correlation method may not be suitable.
After applying the bias correction and time alignment, plot the signals to visually inspect the synchronization. Also, calculate the correlation coefficient to quantify the synchronization:
correlation_coefficient = corrcoef(r_aligned, e_aligned);
Refer to the below documentation for more information on xcorr and corrcoef:

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by