I am very surprised not to find a version of normxcorr2 for 1D signals in Matlab ! I implemented something like that by hand (with 2 for loops, and normalizing the template as well as the window under the template (in the 1D signal in which the template is searched).
Did I just not find it or does it not exist? (A normalized cross correlation (NCC) for 1D signals, i.e., like normxcorr2 but for vectors)
(cf. https://ch.mathworks.com/help/images/ref/normxcorr2.html for the 2D version )
template=[1 2 3] signal=[0 1 4 8 9 3 7 7 1 2 3 0 5 5 0]
the NCC should find the max at a lag of 9 (because you can see that the pattern [1 2 3] starts at pos 9). I consider here sliding the template starting at the template positioned over the window [0 1 4] of the signal and finishes at [5 5 0] , like that I obtain an output signal of length:
P.S. and it seems clearly that corr or xcorr does not do the same thing even with the 'normalization' argument because what I am looking for is something that normalized the kernel and the window in the signal at each step, which is quite cumbersome but needed for the NCC as mentioned in : http://www.cse.psu.edu/~rtc12/CSE486/lecture07.pdf for example)