Consider a signal that is a sum of sinusoids, e.g. $x(t)=Asin(at)+Bcos(bt)$
Is there an easy and general way to get an analytical solution for the autocorrelation of $x(t)$?
Is the best way to simply plug $x(t)$ into the autocorrelation formula?
$$ R_{xx}(\tau)=\int_{-\infty}^{\infty}x(t+\tau)x(t)dt$$
$$ R_{xx}(\tau)=\int_{-\infty}^{\infty}[Asin(a(t+\tau))+Bcos(b(t+\tau))][Asin(at)+Bcos(bt)]dt$$
$$ R_{xx}(\tau)=\int_{-\infty}^{\infty}[A^2sin(a(t+\tau))sin(at) +ABsin(a(t+\tau))cos(bt) + ABcos(b(t+\tau))sin(at) + B^2cos(b(t+\tau))cos(bt)]dt$$
Now evaluating each one independently,
$$ R_{xx}(\tau)=\frac{A^2}{2}cos(a\tau)+\frac{AB}{2}sin(a\tau)-\frac{AB}{2}sin(b\tau)+\frac{B^2}{2}cos(b\tau)$$
The algebra can get pretty messy if we have a larger sum of sinusoids like $x(t)=Asin(at)+Bcos(bt)+Csin(ct)+Dcos(dt)+...$
Do I just have to bite the bullet and do the all the algebra? Or is there some general formula?
Here's my solution.
Consider a general sum of sinusoids
$$ x(t) = \sum_i C_if_i(a_it) $$
where $f_i(a_i t) = sin(a_i t)$ or $f_i(a_i t) = cos(a_i t)$. The coefficients $C_i$ are simply constants. For example this sum could take the form $x(t) = 2cos(2t)-3cos(3t)+4cos(4t)-5sin(5t)$.
Now, substitute this sum into the autocorrelation formula:
$$ R_{xx}(\tau)=\int_{-\infty}^{\infty}x(t+\tau)x(t)dt$$
And realize that each term in the integrand can be one of the following four cases:
$$ \int_{-\infty}^{\infty}C_iC_jsin(a_i(t+\tau))sin(a_jt)dt = \frac{C_iC_j}{2}cos(a_i\tau)$$
$$ \int_{-\infty}^{\infty}C_iC_jsin(a_i(t+\tau))cos(a_jt)dt = \frac{C_iC_j}{2}sin(a_i\tau)$$
$$ \int_{-\infty}^{\infty}C_iC_jcos(a_i(t+\tau))sin(a_jt)dt = -\frac{C_iC_j}{2}sin(a_i\tau)$$
$$ \int_{-\infty}^{\infty}C_iC_jcos(a_i(t+\tau))cos(a_jt)dt = \frac{C_iC_j}{2}cos(a_i\tau)$$
So the general autocorrelation can be written as a double sum:
$$ R_{xx}(\tau)=\frac{1}{2}\sum_{ij}C_iC_jr_{ij}(\tau)$$
where
$$ r_{ij}(\tau) = \begin{cases} cos(a_i\tau) & \text{if $f_i(a_it)=sin(a_it)$ and $f_j(a_jt)=sin(a_jt)$ }\\ cos(a_i\tau) & \text{if $f_i(a_it)=cos(a_it)$ and $f_j(a_jt)=cos(a_jt)$ }\\ sin(a_i\tau) & \text{if $f_i(a_it)=sin(a_it)$ and $f_j(a_jt)=cos(a_jt)$ }\\ -sin(a_i\tau) & \text{if $f_i(a_it)=cos(a_it)$ and $f_j(a_jt)=sin(a_jt)$ }\\ \end{cases} $$