# Spectral correlation density

The spectral correlation density (SCD), sometimes also called the cyclic spectral density or spectral correlation function, is a function that describes the cross-spectral density of all pairs of frequency-shifted versions of a time-series. The spectral correlation density applies only to cyclostationary processes because stationary processes do not exhibit spectral correlation. Spectral correlation has been used both in signal detection and signal classification. The spectral correlation density is closely related to each of the bilinear time-frequency distributions, but is not considered one of Cohen's class of distributions.

## Definition

The cyclic auto-correlation function of a time-series x(t){\textstyle x(t)} is calculated as follows:
$R_{x}^{\alpha }(\tau )=\int _{-\infty }^{\infty }x\left(t-{\frac {\tau }{2}}\right)x^{*}\left(t+{\frac {\tau }{2}}\right)e^{-i2\pi \alpha t}\,dt$
where (*) denotes complex conjugation. By the Wiener–Khinchin theorem [questionable, discuss], the spectral correlation density is then:
$S_{x}^{\alpha }(f)=\int _{-\infty }^{\infty }R_{x}^{\alpha }(\tau )e^{-i2\pi f\tau }\,d\tau$

## Estimation methods

The SCD is estimated in the digital domain with an arbitrary resolution in frequency and time. There are several estimation methods currently used in practice to efficiently estimate the spectral correlation for use in real-time analysis of signals due to its high computational complexity. Some of the more popular ones are the FFT Accumulation Method (FAM) and the Strip-Spectral Correlation Algorithm. A fast-spectral-correlation (FSC) algorithm has recently been introduced.

## FFT accumulation method (FAM)

This section describes the steps for one to compute the SCD on computers. If with MATLAB or the NumPy library in Python, the steps are rather simple to implement. The FFT accumulation method (FAM) is a digital approach to calculating the SCD. Its input is a large block of IQ samples, and the output is a complex-valued image, the SCD.
Let the signal, or block of IQ samples, $x$ be a complex valued tensor, or multidimensional array, of shape $(N,)$, where each element is an IQ sample. The first step of the FAM is to break $x$ into a matrix of frames of size $N'$ with overlap.
$X={\begin{bmatrix}x[0:N']\\x[L:L+N']\\x[2L:2L+N']\\x[3L:3L+N']\\.\\.\\.\end{bmatrix}},$
where $L$ is the separation between window beginnings. Overlap is achieved when $L<N'$. $X$ is a tensor of shape $(P,N')$, and $P$ depends on how many frames were able to fit in $x$.
Next a windowing function $a(N')$ of shape $(N',)$, like the Hamming window, is applied to each row in $X$.
$X'={\begin{bmatrix}a(N')\\a(N')\\a(N')\\.\\.\\.\\\end{bmatrix}}\otimes X,$
where $\otimes$ is element-wise multiplication. Next the FFT is taken on each row in $X'$
$W={\begin{bmatrix}FFT(X[0,:])\\FFT(X[1,:])\\FFT(X[2,:])\\.\\.\\.\\\end{bmatrix}}.$
$W$ is commonly known as the waterfall plot, or spectrogram. The next step in the FAM is for the phase to be corrected from delay of the FFTed frames.
$W'={\begin{bmatrix}W[0,:]\\e^{j\omega L}\otimes W[1,:]\\e^{j\omega 2L}\otimes W[2,:]\\e^{j\omega 3L}\otimes W[3,:]\\.\\.\\.\\\end{bmatrix}},$
where $\omega$ is a tensor of shape $(N',)$ corresponding to each digital frequencies in the FFTs
$\omega ={\bigg-\pi ,...,\pi -{\frac {2\pi }{N'}}{\bigg ]}.$
Next the FFTs are autocorrelated to create a tensor $S$ of shape $(P,N',N')$.
$S[i,j,k]=W'[i,j]W'[i,k]^{*},$
where $^{*}$ denotes complex conjugate. In other terms, if we let $W_{i}=W'[i,:]$ be a matrix of shape $(1,N')$, we can rewrite $S$ as
$S[i,:,:]=W_{i}^{H}W_{i},$
where H denotes Hermitian (conjugate and transpose) of a matrix. The next step is to take the FFT of $S$ along the first axis.
$S'[:,i,j]=FFT(S[:,i,j]).$
$S'$ is the full SCD, but in the shape of a 3-dimensional tensor. What we aim for is a 2-dimensional tensor $s$ (a matrix or image) of shape $(PN',N')$ where each entry corresponds to a particular frequency $f$ and cyclic frequency $\alpha$. All values of $\alpha$ in $S'$ can be arranged in the tensor $A$, and all values of $f$ in $S'$ in the tensor $F$. Here, $f\in [-.5,+.5)$ and $\alpha \in [-1,+1)$ are normalized frequencies.
$F[i,j,k]={\frac {j+k}{2N'}}-.5.$
$A[i,j,k]={\frac {j-k}{N'}}+{\biggi-{\frac {P}{2}}{\bigg )}\Delta \alpha .$
where $\Delta \alpha =1/N$. Now the SCD image $s$ can be arranges in the form of a matrix with zeros where there are no values for a particular $(f,\alpha )$ pair in $S'$, and entries from $S'$ where it is valid as per $A$ and $F$.

### Estimating the SCD by skipping the second FFT

The full SCD is a rather large and computationally complex, mostly due to the second round of FFTs. Fortunately, from $S'$ an estimate $s'$ of the SCD can be calculated as
$s'={\frac {1}{P}}\sum _{i=0}^{P-1}S'[i,:,:].$
For even less computational complexity, we can compute $s'$ as
$s'={\frac {1}{P}}\sum _{i=0}^{P-1}S[i,:,:],$
because averaging all values in an FFT window before or after an FFT are equivalent. Note that $s'$ will look like a 45 degree rotated version of the true SCD $s$.