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!
Best Answer