Clear Filters
Clear Filters

why the result of cross-correlation coefficient is 1?

5 views (last 30 days)
Hi,there is a simple program to compute the cross correlation coefficient between 'orginal signal' and 'reconstructing signal'。There are two questions: (1)why the values of the X and the Y are different? (2)now that the values are different,why the cross correlation coefficient is always 1, in spite of different dbN wavelet? Help me please!Thank you!
x=randn(1,50);
[cA,cD]=dwt(x,'db4');
subplot(311);
plot(x);
title('Original signal');
y=idwt(cA,cD,'db4');
subplot(312);
plot(y);
title('Reconstructing signal');
difference=x-y;
subplot(313);
plot(difference);
title('error');
r=corrcoef(x,y)

Accepted Answer

Wayne King
Wayne King on 10 Mar 2012
Hi Bin, the Cyclist is absolutely right. There is no difference between the two because all you have done is invert the wavelet transform.
When you say there are differences, what are the sizes of these "differences"?
execute this line and see what you get:
max(abs(x-y))
I get something on the order of 10^(-12) for my particular realization of randn().
When the largest difference between any two elements of a vector is that small, then you should not expect the cross correlation sequence to be anything but 1 at all lags.
  1 Comment
bin
bin on 10 Mar 2012
Hi Wayne King,thank you for your detailed explanation,and I have understood the reason.

Sign in to comment.

More Answers (1)

the cyclist
the cyclist on 10 Mar 2012
I am not an expert on wavelet transforms, but first you transform "x", and then you apply the inverse transform (with the same coefficients and N) to that to get "y". Therefore, x is equal to y, and they have perfect correlation.
  1 Comment
bin
bin on 10 Mar 2012
Thank you for your answer!There should not be difference existed between X and Y,on the contrary the difference is really existing,whatever the value or the length of X.Looking from the values of X and Y,the cross correlation coefficient should be also existed.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!