I have one sample for a signal. This sample is a vector of length 384. I need to calculate the correlation matrix for this signal,So I need many samples for the same signal. How can i generate these samples form the given sample using Matlab?

  • 1
    $\begingroup$ can you be specific about what you mean by correlation matrix. $\endgroup$
    – user28715
    Oct 20 '18 at 14:13
  • $\begingroup$ I mean the autocorrelation matrix of the signal $\endgroup$ Oct 20 '18 at 15:45
  • 1
    $\begingroup$ hi: you just calculate the autocorrelations using the one sample so no need for more than one. this is okay because of the ergodicity assumption that is usually made about time-series. also, note that matrix is symmetric. $\endgroup$
    – mark leeds
    Oct 20 '18 at 16:04

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:


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


$$\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.

Convolution as matrix multiplication

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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.