Cross-Correlation : Comparing two signals or finding the location of a target I read across places that cross-correlation of two signal (a radar sending a signal and receiving it back) one can detect the location (distance) of a target from a point and that cross-correlation can be used for comparing signals.

I solved a question to find cross-correlation of two finite length sequences where:

x(l)={1,2,1,1}
y(l)={1,1,2,1}


The cross-correlation sequence came as: 

{1,4,6,6,5,2,1}


The answer was also correct as per my verification. 

But I am not able to understand how using the above cross-correlation sequence value I can state it to be used for -


  a)location of a target? b)comparing signals x and y?
Your example would be more illuminating for you if you did this:

x(l)={1,2,1,1}

y(l)={0,0,0,0,0,0,0,1,2,1,1}

The peak of the crosscorrelation would then tell you how far into y(1) the contents of x(1) are.  If x(1) represents a radar pulse, then y(1) represents the received reflection.  The peak of the cross correlation then tells you how long it took for the reflection to return.  This tells you how far away the obect that reflected your signal - you then know where that object is.

Cross correlating also tells you how similar two signals are.  The higher the peak, the more the two signals are alike.

Try these to see what I mean:

These have a relatively low peak

x(l)={1,2,0,0}

y(l)={0,1,1,1}

compared to this next set which has a relatively high peak:

x(l)={1,2,0,0}

y(l)={1,2,0,0}