# Reverse a cross correlation with MatLab

Started by August 4, 2006
```I have a cross-correlation signal and one of the two signas that were
cross-correlated: CC=A*B
I have CC and let's say A.
Now I try to find the second signal B.

In detail: CC and A is are normalized envelops of a pulse that are kind of
gaussian. At the beginning and the end of the vektors there are a lot of
zero values.

I played around with the original formulars with FFT, but doing the
de-folding with FFT my resulting B has additional maximums at the
beginning and the end of the vektor.

The I tried the deconv-Funktion, but I am not sure if the result ist
correct, because die peak in CC has a larger width than the one in A. And
the resulting B has te same width as in CC. That does not seem to make
sense, as I would expect a smaler pulse width in B than in CC.

I use:
[q,r]=deconv(CC,A);
CC and A both have 255 vales
The resulting q is a single value and r also has 255 values.
I guess r is the B I search for?

Does anybody have an idea if I am doing right??

```
```Eryxi wrote:
> I have a cross-correlation signal and one of the two signas that were
> cross-correlated: CC=A*B
> I have CC and let's say A.
> Now I try to find the second signal B.

would B be unique? I don't know

```
```Eryxi wrote:
> I have a cross-correlation signal and one of the two signas that were
> cross-correlated: CC=A*B
> I have CC and let's say A.
> Now I try to find the second signal B.

For what its worth : I'd say B = CC / A :)
(Forgive my high school math ^_^ )

```
```Eryxi wrote:

> I have a cross-correlation signal and one of the two signas that were
> cross-correlated: CC=A*B
> I have CC and let's say A.
> Now I try to find the second signal B.
>
> In detail: CC and A is are normalized envelops of a pulse that are kind of
> gaussian. At the beginning and the end of the vektors there are a lot of
> zero values.
>
> I played around with the original formulars with FFT, but doing the
> de-folding with FFT my resulting B has additional maximums at the
> beginning and the end of the vektor.
>
> The I tried the deconv-Funktion, but I am not sure if the result ist
> correct, because die peak in CC has a larger width than the one in A. And
> the resulting B has te same width as in CC. That does not seem to make
> sense, as I would expect a smaler pulse width in B than in CC.
>
> I use:
> [q,r]=deconv(CC,A);
> CC and A both have 255 vales
> The resulting q is a single value and r also has 255 values.
> I guess r is the B I search for?
>
> Does anybody have an idea if I am doing right??

Nope. Q should be the B. However, I doubt deconv works if the signals are
not accurately cc = xcorr(a,b) (for example, if there is noise present).

Try this:

a = rand(1,5);
b = rand(1,5);
cc = xcorr(a,b);
bhat = fliplr(deconv(cc,a));
sum(abs(b-bhat))

On my machine with Octave, the result is close to zero. That is, bhat equals
to b.

--
Jani Huhtanen
Tampere University of Technology, Pori
```