I am trying to compare vectors that sample across two spatial fields. One is divergence in wind field. Other is rainfall intensity. There appears to be a correlation in the two fields but with a notable spatial lag between peak value in one sample vector and peak value in the other. We want to quantify this and xcorr would seem to be the logical choice.
If I am interpreting the docs for xcorr correctly, it gives us the cross correlation between the two curves at every possible offset. In our case, the offset is spatial vs. temporal, but that should not matter?
The result we generate is confusing. We do get a reasonable lag value from xcorr, but the correlation values do not make sense to us. In particular, they are not the expected Pearson's R values in range between -1 and 1.
As a baseline test we run xcorr comparing one of our curves to itself. We do get the expected 0 value for lag, but the correlation value generated at zero lag is also near zero. In that case what we'd expect would be perfect correlation of 1.0.
When we run the same tests using the MATLAB corr and corrcoef functions, we do get the expected 1.0 value. We could use either of those functions for our testing, but neither accounts for the spatial lag in our input vectors.
So the questions: 1) what is xcorr generating for its correlation values, and 2) is there some way to get xcorr to generate standard Pearson Product Moment Correlation (R) values?