Filter löschen
Filter löschen

time delay between two signals from the same source

4 Ansichten (letzte 30 Tage)
Padma
Padma am 27 Okt. 2011
Hi
Could someone help me to find the time delay between two signals coming from the same source by using the concepts of correlation and autocorrelation. I am new to matlab, so could you please explain from the basic concepts?
Thanks in advance

Akzeptierte Antwort

Honglei Chen
Honglei Chen am 27 Okt. 2011
You can use xcorr to determine the delay in samples and then use sampling frequency to find out the exact delay in time.
fs = 100;
t = 0:1/fs:1;
x = sin(2*pi*t);
y = sin(2*pi*t+pi/10);
[c, lags] = xcorr(x,y)
If you examine c, the maximum is at index 106, which corresponds t a lag of (see lags) 5. This means the two signals match at a delay of 5 samples. You can translate that to time by dividing the number of samples with the sampling frequency. You can also use findpeaks to automate the peak search.
HTH

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by