Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Regarding plot of cross correlation
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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.
1 comentario
Respuestas (1)
Image Analyst
el 20 de Oct. de 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.
0 comentarios
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!