How do I know if the finddelay function is significant?
이전 댓글 표시
I am currently using the finddelay function to visualize a wave pattern. I have a matrix with periodic signals recorded and I use one of the signals as a reference to which I compare all of the others to achieve a matrix of delays which I then visualize as different colours in a matrix plot.
I my case I would assume to have sufficient correlation with the majority of the signals but what do the function actually return for the few that does not have a correlation? Will I get 0 as delay? I have looked into the code of the function but could not figure it out by myself. Would it be possible to adapt the function to get it to return a special value when there is no correlation so that I could single out and mark theses spots in my plot?
Related to this I also wonder if there is some general rule of how long this type of signals should be for the finddelay function to be applicable?
Thank you, Emelie
답변 (2개)
Wayne King
2013년 4월 28일
편집: Wayne King
2013년 4월 28일
It is not true that you will get back a delay of zero for cases when the signals are not significantly correlated at any lag.
rng default;
x = randn(100,1);
y = randn(100,1);
[xc,lags] = xcorr(x,y,20,'coeff');
[rho,idx] = max(abs(xc));
lags(idx)
And cross-correlation sequences that achieve a maximum at zero lag can certainly indicate significant cross-correlation. Think about the autocorrelation of a sequence.
Depending on what distributional assumptions you can reasonably make about your signals, it may well be possible to come up with a principled threshold for significant cross-correlation, but just for the moment, let's assume you want to see at least 0.5
You can do something like this
[xc,lags] = xcorr(x,y,20,'coeff');
[rho,lags] = max(abs(xc));
if (rho>=0.5)
Lag = lags(idx);
else
Lag = NaN;
end
Wayne King
2013년 4월 27일
0 개 추천
If the signals are equal length, then why not use xcorr() with the 'coeff' option?
Then the cross-correlation will lie in the range [-1,1] and you pretty easily assess how significant the cross-correlation is when it achieves its maximum.
카테고리
도움말 센터 및 File Exchange에서 Correlation and Convolution에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!