Search code examples
signalssignal-processingsampling

correlation analysis of two signal in matlab


let us consider following code

>> load relatedsig.mat;
>> [C1,lag1] = xcorr(T1,S);
[C2,lag2] = xcorr(T2,S);

figure
ax(1) = subplot(211);
plot(lag1/Fs,C1,'k');
ylabel('Amplitude');
grid on
title('Cross-correlation between Template 1 and Signal')
ax(2) = subplot(212);
plot(lag2/Fs,C2,'r');
ylabel('Amplitude');
grid on
title('Cross-correlation between Template 2 and Signal')
xlabel('Time(secs)');
axis(ax(1:2),[-1.5 1.5 -700 700 ])
>> 

i have question related to this part - plot(lag1/Fs,C1,'k');

why we are dividing lags by sampling frequencies? thanks in advance


Solution

  • Fs say to you how many sample per second your signal was recorded !

    So when you divide your lag by sampling frequencies, you just was converting the lag position in seconds.

    it tells you how many seconds of delay was returned by correlation!