# xcorr

xcorr(u,v)

Compute the cross-correlation of two vectors.

## Examples

1. Compute the cross-correlation of two vectors:

``````julia> u = [1, 2, 3, 4, 5];
julia> v = [2, 4, 6];
julia> xcorr(u, v)
7-element Array{Int64,1}:
2
8
20
32
29
20
12``````

This example calculates the cross-correlation between vectors `u` and `v`.

2. Compute the cross-correlation of two time-series 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)
8-element 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 cross-correlation between two time-series 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`.