SignalProcessing - Maple Programming Help

Home : Support : Online Help : Science and Engineering : Signal Processing : Convolution and Correlation Computations : SignalProcessing/CrossCorrelation

SignalProcessing

 CrossCorrelation
 estimate the cross-correlation of two arrays containing samples

 Calling Sequence CrossCorrelation(A, B)

Parameters

 A, B - Arrays of real or complex numeric values; the signals lowerlag - integer, lower value of the range of lags at which the correlation estimates are computed

Options

 • container : Array, predefined Array for holding result

Description

 • The CrossCorrelation(A, B) command estimates the cross-correlation of the Vectors A and B of length $M$ and $N$ respectively. An Array of length $M+N-1$ containing the result is returned.
 • The cross-correlation is defined by the formula

${C}_{k}={\sum }_{i=1}^{M}\stackrel{&conjugate0;}{{A}_{i}}{B}_{k+i+\mathrm{lowlag}}$

 for $1\le k$ and $k\le M+N-1$. Here, ${B}_{i}$ is taken to be $0$, for $N.
 • Before the code performing the computation runs, Maple converts A and B to a hardware datatype, first attempting float and subsequently complex, unless they already have one of these datatypes. For this reason, it is most efficient if they have one of these datatypes beforehand. The output will have the datatype that the computation is performed in.
 • If the container=C option is provided, then the results are put into C and C is returned. With this option, no additional memory is allocated to store the result. The container must be an Array of size $M+N-1$ having datatype float if A and B are real, and complex otherwise.

 • The SignalProcessing[CrossCorrelation] command is thread-safe as of Maple 17.

Examples

 > $\mathrm{with}\left(\mathrm{SignalProcessing}\right):$
 > $a≔\mathrm{GenerateUniform}\left(10,-1,1\right)$
 ${a}{≔}\left[\begin{array}{cccccccccc}{-0.785218492150308}& {0.588413964957000}& {-0.993165822699668}& {0.921578288543971}& {-0.0387801709584892}& {0.0136057925410569}& {-0.210756972897798}& {0.749600215815009}& {0.138966357801110}& {0.212285134010017}\end{array}\right]$ (1)
 > $b≔\mathrm{GenerateUniform}\left(7,-1,1\right)$
 ${b}{≔}\left[\begin{array}{ccccccc}{0.338366801850498}& {-0.991120660211892}& {0.488912846427412}& {0.218458360992372}& {-0.977166885510089}& {-0.171592804603279}& {-0.446023768279702}\end{array}\right]$ (2)
 > $\mathrm{CrossCorrelation}\left(a,b\right)$
 $\left[\begin{array}{cccccccccccccccc}{-1.00356349226071}& {-0.0509858555173067}& {0.574289970860068}& {-0.987141898411714}& {1.10929746867185}& {-0.127708770664093}& {0.350226110791786}& {0.}& {0.}& {0.}& {0.}& {0.}& {0.}& {0.}& {0.}& {0.}\end{array}\right]$ (3)
 > $\mathrm{CrossCorrelation}\left(a,b,0\right)$
 $\left[\begin{array}{cccccccccccccccc}{-1.00356349226071}& {-0.0509858555173067}& {0.574289970860068}& {-0.987141898411714}& {1.10929746867185}& {-0.127708770664093}& {0.350226110791786}& {0.}& {0.}& {0.}& {0.}& {0.}& {0.}& {0.}& {0.}& {0.}\end{array}\right]$ (4)
 > $\mathrm{CrossCorrelation}\left(a,b,-9\right)$
 $\left[\begin{array}{cccccccccccccccc}{0.0718302418753740}& {-0.163378580119205}& {0.219696328523752}& {-0.699939523691604}& {0.402898873345852}& {-0.138112186049403}& {-0.540136600081978}& {-1.25010101666989}& {1.31407626623769}& {-1.00356349226071}& {-0.0509858555173065}& {0.574289970860068}& {-0.987141898411714}& {1.10929746867185}& {-0.127708770664093}& {0.350226110791786}\end{array}\right]$ (5)
 > $c≔\mathrm{Array}\left(1..\mathrm{numelems}\left(a\right)+\mathrm{numelems}\left(b\right)-1,'\mathrm{datatype}'={'\mathrm{float}'}_{8}\right):$
 > $\mathrm{CrossCorrelation}\left(a,b,'\mathrm{container}'=c\right)$
 $\left[\begin{array}{cccccccccccccccc}{-1.00356349226071}& {-0.0509858555173065}& {0.574289970860068}& {-0.987141898411714}& {1.10929746867185}& {-0.127708770664093}& {0.350226110791786}& {0.}& {0.}& {0.}& {0.}& {0.}& {0.}& {0.}& {0.}& {0.}\end{array}\right]$ (6)
 > $c$
 $\left[\begin{array}{cccccccccccccccc}{-1.00356349226071}& {-0.0509858555173065}& {0.574289970860068}& {-0.987141898411714}& {1.10929746867185}& {-0.127708770664093}& {0.350226110791786}& {0.}& {0.}& {0.}& {0.}& {0.}& {0.}& {0.}& {0.}& {0.}\end{array}\right]$ (7)

Compatibility

 • The SignalProcessing[CrossCorrelation] command was introduced in Maple 17.