xcorr
xcorr(u,v)
Compute the crosscorrelation of two vectors.
Examples

Compute the crosscorrelation of two vectors:
julia> u = [1, 2, 3, 4, 5]; julia> v = [2, 4, 6]; julia> xcorr(u, v) 7element Array{Int64,1}: 2 8 20 32 29 20 12
This example calculates the crosscorrelation between vectors
u
andv
.  Compute the crosscorrelation of two timeseries signals:
julia> signal1 = [0.5, 0.7, 0.9, 1.2, 1.0]; julia> signal2 = [1.1, 0.8, 0.6, 0.4]; julia> xcorr(signal1, signal2) 8element Array{Float64,1}: 0.55 0.94 1.5 2.02 2.45 1.58 0.9 0.48
In this example, the
xcorr
function is used to compute the crosscorrelation between two timeseries signals.
Common mistake example:
julia> u = [1, 2, 3];
julia> v = [4, 5, 6, 7];
julia> xcorr(u, v)
ERROR: DimensionMismatch("vectors must have the same length")
In this case, the vectors u
and v
have different lengths, which results in a DimensionMismatch
error. Ensure that the input vectors have the same length to avoid this error when using xcorr
.
See Also
User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.