abhigopal said:
Hi all,
I have a question! I have a vector( array of elements) and I need to compute the auto-correlation matrix for this. How do I do it in Matlab. This matrix needs to be toeplitz and symmetrical.
I had the same doubt as you, and I still dont know if I achieved the solution, I will share it , and I will be glad if I had comments:
the crosscorrelation matriz is quoted in AR, ARMA methods, LMS, RLS and many others, it is a toeplitz hermitian matrix.
Lets consider a randon set of data and find the autocorrelation matrix:
>> x=rand(1,5)
x =
0.6154 0.7919 0.9218 0.7382 0.1763
>> r=xcorr(x)
r =
0.1085 0.5939 1.3144 2.0280 2.4317 2.0280 1.3144 0.5939 0.1085
>> R= toeplitz(r)
R =
0.1085 0.5939 1.3144 2.0280 2.4317 2.0280 1.3144 0.5939 0.1085
0.5939 0.1085 0.5939 1.3144 2.0280 2.4317 2.0280 1.3144 0.5939
1.3144 0.5939 0.1085 0.5939 1.3144 2.0280 2.4317 2.0280 1.3144
2.0280 1.3144 0.5939 0.1085 0.5939 1.3144 2.0280 2.4317 2.0280
2.4317 2.0280 1.3144 0.5939 0.1085 0.5939 1.3144 2.0280 2.4317
2.0280 2.4317 2.0280 1.3144 0.5939 0.1085 0.5939 1.3144 2.0280
1.3144 2.0280 2.4317 2.0280 1.3144 0.5939 0.1085 0.5939 1.3144
0.5939 1.3144 2.0280 2.4317 2.0280 1.3144 0.5939 0.1085 0.5939
0.1085 0.5939 1.3144 2.0280 2.4317 2.0280 1.3144 0.5939 0.1085
So R is a toeplitz and Hermitian matrix built with the autocorrelation of x. Is it right ?
abhigopal said:
Also on the same lines, How do i perform cross correlation between 2 sets of elements (arrays again) using matlab.
I need all this because of work I am doing in Statistical Signal Processing,
Thanks all
Abhi
To perform crosscorrelation you take the two set of data x1,x2 and use the comand xcorr1(x1,x2) care must be taken when the signals are periodic and of different lengths, in this case you have to zero pad N2-1 zeros to x1 and N1-1 zeros to x2 where N1 and N2 are the length of x1 and x2.