### 2.74 Find the cross correlation between two sequences

Problem: Given \begin {align*} A & =[0,0,2,-1,3,7,1,2,-3,0,0]\\ B & =[0,0,1,-1,2,-2,4,1,-2,5,0,0] \end {align*}

Notice that the output sequence generated by Mathematica and Matlab are reversed with respect to each others.

Also, MATLAB uses the length $$2N-1$$ as the length of cross correlation sequence, which in this example is 23 because $$N$$ is taken as the length of the larger of the 2 sequences if they are not of equal length which is the case in this example.

In Mathematica, the length of the cross correlation sequence was 22, which is $$2N$$.

 Mathematica Clear["Global*"]; a={0,0,2,-1,3,7,1,2,-3,0,0}; b={0,0,1,-1,2,-2,4,1,-2,5,0,0}; c=Reverse[ListCorrelate[a,b,{-1,1},0]]  Out[31]= {0, 0, 0, 0, 10, -9, 19, 36, -14, 33, 0, 7, 13, -18, 16, -7, 5, -3, 0, 0, 0, 0} 

 Matlab In MATLAB use the xcross in the signal processing toolbox clear all; close all; A=[0,0,2,-1,3,7,1,2,-3,0,0]; B=[0,0,1,-1,2,-2,4,1,-2,5,0,0]; C=xcorr(A,B); format long C'  ans = 0.000000000000003 0.000000000000002 -0.000000000000002 0 9.999999999999998 -9.000000000000002 19.000000000000000 36.000000000000000 -14.000000000000000 33.000000000000000 -0.000000000000002 6.999999999999998 13.000000000000000 -18.000000000000000 16.000000000000004 -7.000000000000000 4.999999999999999 -2.999999999999998 -0.000000000000000 0.000000000000001 0.000000000000002 -0.000000000000004 0 

Maple

a:=Array([0,0,2,-1,3,7,1,2,-3,0,0]);
b:=Array([0,0,1,-1,2,-2,4,1,-2,5,0,0]);
SignalProcessing:-CrossCorrelation(a,b);

`

$[ 7.0, 0.0, 33.0,- 14.0, 36.0, 19.0,- 9.0, 10.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]$

Not able to ﬁnd out now why Maple result is diﬀerent. May be deﬁnition used is diﬀerent, no time now to ﬁnd out.