Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Regarding plot of cross correlation

2 Ansichten (letzte 30 Tage)
kavya saxena
kavya saxena am 20 Okt. 2012
Hi all, please check it out. It's urgent
I'm doing cross correlation of two column vector using xcorr() function. My code is
time=data(:,1);
>> ux1=data(:,2);
>> ux2=data2(:,2);
>> cc=xcorr(ux1,ux2);
>> plot(time,cc);
it gives an error that vectors must be same length. then i did
>> n=length(time);
>> r=cc(1:n);
>> plot(time,r);
it does not gives a peak value, then i again did
>> plot(time,abs(r));
>> y=max(abs(r))
It gives the plot having one peak but I'm not sure that it is correct, becoz the time at peak value is not matching with my theoretical value.

Antworten (1)

Image Analyst
Image Analyst am 20 Okt. 2012
Do this
length(time) % No semicolon
length(cc) % No semicolon
and see what they print in the command window. They will be different lengths because the correlated signal's length is the sum of the two signals lengths minus 1. Try this:
plot(cc, 'bo-');
Why do you think there are more elements in cc than time? How do you think you need to construct a new time array so that it's the same length? What element of the new array corresponds to element 1 of the old time array? Maybe you should try some simple correlations by hand with like 5 elements and see what happens. It will be instructive.

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by