Effacer les filtres
Effacer les filtres

time delay between two signals from the same source

4 vues (au cours des 30 derniers jours)
Padma
Padma le 27 Oct 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
  1 commentaire
Daniel Shub
Daniel Shub le 27 Oct 2011
Are the two signals correlated?

Connectez-vous pour commenter.

Réponse acceptée

Honglei Chen
Honglei Chen le 27 Oct 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

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by