how to cross correlate two signals to know the time delay?
    3 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
I have an input and an output signal. Time is given in column D, input voltage is in column E and out-put in column F of my excel file with a name "SaeedData". I want to know the arrival time of out-put signal. this can be done by cross-correlation of the two measurements. Cross-correlation of the two measurements is maximum at a lag equal to the delay. I want to Plot the cross-correlation and also express the delay as a number of samples and in seconds. I have written the following matlab code with a name "cross" but it gives me the following error. Error in cross (line 7) c = xcorr(x1,x2); my code is following, I have also attached the excel file. filename='SaeedData.csv'; sheetname=1; % Fs = 2500; t = xlsread(filename, sheetname,'D1:D2500'); x1 = xlsread(filename, sheetname,'E1:E2500'); x2 = xlsread(filename, sheetname,'F1:F2500'); c = xcorr(x1,x2); [c,lags] = xcorr(x1,x2); subplot(3,1,1) plot(lags,c); grid on; xlabel('Lag'); ylabel('Cross-correlation'); subplot(3,1,2) plot(t,lags); grid on; xlabel('Lag'); ylabel('Cross-correlation'); subplot(3,1,2) plot(c,t); grid on; xlabel('Lag'); ylabel('Cross-correlation');
0 Kommentare
Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
