Thanks for your response, that sounds like it is the cause of the problem I'm having. I took a step back from the audio portion of my problem and I'm trying to work with the corrr1d function with just simple double arrays, but the results I'm getting are still not correct (for the most part). My question is whether the cross correlation capabilities of alglib will only work properly if the pattern is completely contained within the signal. I've ran the function on a couple of different arrays and this seems to be the case. For example:
double[] Signal = new double[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; double[] Pattern = new double[] { 4, 5, 6, 7, 8, 9, 10, 11, 12 }; alglib.corrr1d(Signal, Signal.Length, Pattern, Pattern.Length, out Result); Result = 348 420 492 564 636 552 469 388 310 236 167 104 48...
with the highest value being at index=5, which is the correct lag. But when I run it on this example:
double[] Signal = new double[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; double[] Pattern = new double[] { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; alglib.corrr1d(Signal, Signal.Length, Pattern, Pattern.Length, out Result); Result = 962 884 803 720 636 552 469 388 310 236...
with the highest value being at index=0, which is not the result I was expecting. I was expecting the highest value to be at the same index, just with a lower correlation value. So do you know if the pattern needs to be completely contained within the signal?
|