Correlation of a signal
The Toeplitz matrix is used to compute correlation and convolution using matrix multiplication. Below is a graphic showing how to use a Toeplitz matrix specifically to perform convolution using matrix multiplication. A cross-correlation function can also be done following the same process by simply reversing the order of the coefficients in the multiplied vector (in this case we would multiply by [h3 h2 h1] to perform correlation).

This is clearer by observing the similarity and differences in the formulas for discrete time convolution and cross-correlation:

CONVOLUTION:

$$r[n]*h[h] = \sum_{m=-\infty}^\infty r[m]h[n-m]$$

CROSS CORRELATION:

$$\rho_{rh}[n] = \sum_{m=-\infty}^\infty r[m]h[m+n]$$

The code in the blue cell in the graphic is the implementation in either Matlab or Octave. This applies to auto-correlation or cross-correlation as an alternate to using the xcorr() function directly.



The utility of doing this is clearer in the following post, where I used such an operation to help demonstrate the underlying operation of the LMS equalizer:

Compensating Loudspeaker frequency response in an audio signal