Digital Signal Processing Reference
In-Depth Information
rho = sxy / sqrt(sxx*syy);
When run, we see that the output rho (), the cross-correlation, is a much better
value to use since it gives us an indication (up to 1) of how well the two signals match.
>> clear all
>> x = [ 0 0 1 5 1 -2 -3 -2 0 0 ];
>> y = [ 1 5 1 -2 -3 -2 0 0 0 0 ];
>> yn = -y;
>> y10 = y*10;
>> rho = correlate(8, x, y)
rho =
1
>> rho = correlate(8, x, y10)
rho =
1
>> rho = correlate(8, x, yn)
rho =
-1
The last example shows that a negative correlation exists between x and yn (the
negated version of y). The cross-correlation function takes care of the fact that the
signals may be scaled versions of each other. That is, we found that x and y10 above
were a match, even though y10's values were 10 times that of x's.
Let us look at another example. What if we try to correlate x to a signal that
is not like it? We will call the second signal noise.
>> clear all
>> x = [ 0 0 1 5 1 -2 -3 -2 0 0 ];
Search WWH ::




Custom Search