Given a signal $x(t)$, how do I implement a form of autocorrelation function defined as $a(t,T) = x(t-T)x(t+T)$, where $T$ is an arbitrary constant?

(a fast implementation would be ideal)

Edit: This kind of signal I came across from seeing a "Parametric Symmetric Autocorrelation function", defined as above.

It is used in time-frequency analysis methods like WVD,...etc. $ R(t,\tau) = x(t + \frac{\tau}{2})x^{*}(t-\frac{\tau}{2})$

Thus far, I have implemented the steps as below for an example chirp: but the output of the fft2 at the end is wrong. (not a correct frequency)

At the output of the autocorrelation function (the PSIAF variant): This output from autocorrelation seems correct

The final output of the LVD is wrong (should be point like):

Solved: Will look at using some of the already published C codes as per answer below to compute the $ R(t,\tau) $

  • 1
    $\begingroup$ continuous time ? your autocorrelation definition is also wrong. $\endgroup$
    – Fat32
    Jun 25, 2016 at 15:36
  • $\begingroup$ for discrete time, actually instead of the autocorrelation of $x(t)x(t-T)$, wanted a variant $\endgroup$
    – matthew
    Jun 25, 2016 at 16:28
  • 2
    $\begingroup$ what @Fat32 means, is that there is something missing from your autocorrelation definition. matthew, it seems to me that there is some things still a bit outa your game. $\endgroup$ Jun 25, 2016 at 18:20
  • $\begingroup$ Can I please ask what do you mean by "variant"? Also, it would help in getting more useful answers if the question was edited to become clearer. What are you trying to achieve? What have you tried so far? What is the exact problem you are requiring help with? $\endgroup$
    – A_A
    Jun 30, 2016 at 8:09
  • $\begingroup$ thanks for the comments, I have added more details about the problem and what i am trying to achieve $\endgroup$
    – matthew
    Jul 1, 2016 at 8:03

2 Answers 2


This line seems wrong:

X = signal(X1_signal_indices).*conj(X1conj_signal_indices); 

shouldn't it be

X = signal(X1_signal_indices).*conj(signal(X1conj_signal_indices)); 


Note that there is some C code for implementing the WVD and other distributions here. That code calculates your $R(t,\tau)$ first before convolving various 2D functions with it and then taking the FFT in order to generate the different distributions.


The definition of autocorrelation (for a real-valued signal $x$) is

$$ R_{xx}(T) = \sum_{n=1}^N{x(n)x(n-T)} $$

where $T$ is the time lag and $N$ is the number of data in $x$.

You only have to calculate $R_{xx}$ for positive $T$ since it is an even function. If you want to optimize further you may approximite by using

$$ \hat{R}_{xx}(T) = \sum_{n=1}^N{x(n)\mathrm{sgn}[x(n-T)]} $$

where $\mathrm{sgn}$ is the sign function, this will remove all the float/double multiplications and gives a pure summation.

  • $\begingroup$ @Clas Rolen I believe taking FFT, reversing, and then multiplying the reversed signal with the original is a more efficient solution especially for long auto-correlation functions. $\endgroup$
    – Dole
    Jun 29, 2016 at 1:08
  • $\begingroup$ In the context of TF analysis, the OP's definition of autocorrelation is appropriate: en.wikipedia.org/wiki/… $\endgroup$
    – Robert L.
    Jun 22, 2018 at 23:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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