title: Autocorrelation technique
text: # Autocorrelation technique
  
  The autocorrelation technique is a method for estimating the dominating frequency in a complex signal, as well as its variance. Specifically, it calculates the first two moments of the power spectrum, namely the mean and variance. It is also known as the pulse-pair algorithm in radar theory.
  
  The algorithm is both computationally faster and significantly more accurate compared to the Fourier transform, since the resolution is not limited by the number of samples used.
  
  ## Derivation
  
  The autocorrelation of lag 1 can be expressed using the inverse Fourier transform of the power spectrum $S(\omega )$:
  
      $R(1)={\frac {1}{2\pi }}\int _{-\pi }^{\pi }S(\omega )e^{i\,\omega }d\omega .$
  
  If we model the power spectrum as a single frequency $S(\omega )\ {\stackrel {\mathrm {def} }{=}}\ \delta (\omega -\omega _{0})$, this becomes:
  
      $R(1)={\frac {1}{2\pi }}\int _{-\pi }^{\pi }\delta (\omega -\omega _{0})e^{i\,\omega }d\omega$
      $R(1)={\frac {1}{2\pi }}e^{i\,\omega _{0}}$
  
  where it is apparent that the phase of $R(1)$ equals the signal frequency.
  
  ## Implementation
  
  The mean frequency is calculated based on the autocorrelation with lag one, evaluated over a signal consisting of N samples:
  
      $\omega =\angle R_{N}(1)=\tan ^{-1}{\frac {{\text{im}}\{R_{N}(1)\}}{{\text{re}}\{R_{N}(1)\}}}.$
  
  The spectral variance is calculated as follows:
  
      ${\text{var}}\{\omega \}={\frac {2}{N}}\left(1-{\frac {|R_{N}(1)|}{R_{N}(0)}}\right).$
  
  ## Applications
  
  * Estimation of blood velocity and turbulence in color flow imaging used in medical ultrasonography.
  * Estimation of target velocity in pulse-doppler radar
  