PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

DTFT, DFT, ZT, and FFT 503


R.5.139 The cross-correlation of two sequences f 1 (n) with f 2 (n) is given by

xcorr f s f s((), ()) 12 R 12 ()s f n f n 12 ()(s)over the range       s 
 



n


whereas the convolution is given by

convfs fs fnfs n s
n

((), ()) 12  12 () ( ) 


 


∑ over the range^

R.5.140 The relation between the convolution and cross-correlation is given by

fn fn Rn^211 ( )⊗ ()^2 ()

R.5.141 The MATLAB command xcorr(f) returns the autocorrelation of f, and the com-
mand xcorr(f 1 , f 2 ) returns the cross-correlation of the sequences f 1 with f 2. Observe
that xcorr(f 1 , f 1 ) = xcorr(f 1 ).
R.5.142 Since the convolution can be evaluated using DFT, it is logical to think that DFT
can be used to evaluate the cross-correlation. The relation is given by

DFT[R 12 (n)] = DFT * [f 1 ]. DFT[f 2 ]
or

Rn F kFk^12 ()⇔^1 *() ()^2

R.5.143 Some properties of the correlation function are summarized as follows:
a. R 11 (n) = R 11 (−n)
b. The max[R 11 (n)] occurs at n = 0
c. R 12 (n) = R 21 (−n)
d. xcorr(f 1 , f 2 ) = f 1 (n) ⊗ f 2 (−n)
R.5.144 Let fn1 = [0 1 2 –1 –2 0 1 0] and fn2 = [0 1 2 3 4 5 6 7].
a. Evaluate by hand the fi rst three coeffi cients R 11 (0), R 11 (1), and R 11 (2) of the auto-
correlation for fn1 (Figure 5.17).
b. Evaluate by hand the fi rst three coeffi cients R 12 (0), R 12 (1), and R 12 (2) of the cross-
correlation for fn1 with fn2.
c. Verify the preceding results by using the MATLAB commands xcorr(fn1) and
xcorr(fn1, fn2).
d. Compare the results obtained in parts a and b, with part c.
e. Obtain the plots of the autocorrelation function of fn1 and it is an even function
and its maximum value occurs at n = 0.
f. Obtain plots of the cross-correlation xcorr(fn1, fn2) and xcorr(fn2, fn1), and verify
that xcorr(fn1, fn2) ≠. xcorr(fn1, fn2)
Free download pdf