Question: time delay with Statistics[CrossCorrelation]

How to implement the following procedure using the function Maple Statistics [CrossCorrelation]?  

alias(FFT = DiscreteTransforms[FourierTransform], IFFT = DiscreteTransforms[InverseFourierTransform]);

nd := Statistics:-Sample(Normal(0, 1));

 xcorr := proc (x, y)
local corrLength, c;
corrLength := op(1, x)+op(1, y)-1;
c := IFFT(`~`[`*`](FFT(Vector(corrLength, x, fill = 0), normalization = none), `~`[conjugate](FFT(Vector(corrLength, y, fill = 0), normalization = none))), normalization = full);
c := `~`[Re](ArrayTools[CircularShift](c, (1/2)*op(1, c)))
end proc:

x := Vector[column]([nd(1 .. 1000)])

#delay x1 by 6 samples

x1 := Vector([Vector(6), x[() .. -7]])

C := xcorr(x1, x)
c := C[ceil((1/2)*op(1, C))-50 .. ceil((1/2)*op(1, C))+50]
lags := Vector([`$`(-50 .. 50)])
DynamicSystems:-DiscretePlot(lags[51 .. -1], c[51 .. -1], style = stem, axes = box, color = blue)

????????

cc := Statistics[CrossCorrelation](x1, x, 50)

Statistics:-LineChart(cc, axes = box, gridlines, color = blue, title = "Cross correlation Rxy", labels = ["", ""], labeldirections = ["horizontal", "vertical"], view = [DEFAULT, DEFAULT])

??????????

Gracias

Please Wait...