Digital Signal Processing Reference
In-Depth Information
>> noise = [ 0 -1 0 1 0 -1 1 0 1 -1];
>> for i=0:length(x)
my_rho(i+1) = correlate(i, x, noise);
end
>> my_rho
my_rho =
Columns 1 through 6
0.2462
-0.2462
-0.3077
0.3077
0.3693
0.4308
Columns 7 through 11
-0.2462
-0.3077
-0.3077
0.0615
0.2462
>> min_rho=min(my_rho); max_rho=max(my_rho);
>> if (abs(min_rho) > abs(max_rho))
min_rho
else
max_rho
end
max_rho =
0.4308
The array my rho stores all correlation coecients for these two signals. To see
how well x and noise match up, we need to examine both the minimum as well as
the maximum values. With cross-correlation, we are able to say that two signals
match, or that they do not match well.
Example:
The following example comes out of an image processing project. In Figure 3.30, we
see two rectangles. Our goal is to automatically match these two objects, something
people can do easily, but is a dicult pattern-matching process for a computer.
The rectangles are similar, though one is smaller than the other, as well as being
Search WWH ::




Custom Search