Correlation between two random signals
Show older comments
I have two signals in MATLAB, say
a = randn(1,1e6) + randn(1,1e6)*exp(-1i * 2*pi * 1.1);
b = randn(1,1e6) + randn(1,1e6)*exp(-1i * 2*pi * 1.4);
I am finding the correlation between them as follows:
R=corrcoef(a,b);
r = R(2,1);
Now each time I run my code, the correlation coefficient is different. I even tried to increase the number of samples (from 1e6 to higher values) but that didn't work. Is there some other way to find the correlation coefficient between such signals?
Accepted Answer
More Answers (1)
Jan
on 1 Oct 2015
1 vote
It is expected that the correlation between two random signals has a (low) random value. So what do you mean by "that didn't work"? I do not see a reason to look for another way, because corrcoeff works fine. Only your expectations do not agree with the mathematical definition.
2 Comments
rihab
on 1 Oct 2015
Jan
on 1 Oct 2015
Please read the documentation and source code of corrcoeff.m to find out, what's going on. Because you create random inputs for this function each time, the output must be different also. Only the magnitude of the output should be "small", because the inputs are random. You cannot expect the correlation to have a fixed value as e.g. 0.0 even for uncorrelated signals.
Categories
Find more on Correlation and Convolution in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!