You can use xcorr
for a quick and dirty solution, presuming that the shifts are not too large and the sampling is equal:
[c lags] = xcorr(red,blue);
c
is the actual correlations. lags
is the shifts made to the blue
input before correlating it with red
.
Therefore, lags(c==max(c))
should tell you how much to shift blue
to get the best match with red
.