corrcoef mistakenly gives 1 for different amplitude waveforms
Show older comments
I'm trying to obtain the crosscorrelation between sets of oscillations for a lag of zero, here is the relevant part of my code:
yintsplit=(linspace(minimumsplit,maximumsplit,2048))'; y2intsplit=(linspace(minimumsplit,maximumsplit,2048))';
zintsplit = interp1(yisplit,zisplit,yintsplit,'spline'); z2intsplit = interp1(y2isplit,z2isplit,y2intsplit,'spline');
[absplit, lagssplit] = xcorr(zintsplit,z2intsplit, [], 'coeff'); zzsplit = absplit(find(lagssplit == 0));
or
absplit = corrcoeff((zintsplit,z2intsplit); zzsplit = absplit(1,2);
When I plot the two sets of oscillations, they are clearly different. They have the same period, but their amplitude is different. But both xcorr and corrcoef give me a cross-correlation of 1! I'm perplexed, I have no idea what the problem is... Can anyone help? Thanks!
Accepted Answer
More Answers (1)
S
on 4 Nov 2012
0 votes
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!