# Expected Value of a sequence with two random variables

If I have a signal of the form $$x\left(n\right)=Acos\left(nω+ϕ\right)$$

where

$$\omega \in \left[\omega -\lambda ,\omega \:+\lambda \:\right]$$ is a uniform random variable and

$$\phi$$ is also a uniform random variable $$\left[-\pi ,\pi \right]$$.

I need to find the mean and the autocorrelation.

So we know the mean $$E\left[x\left(n\right)\right]\:=\:AE\left[cos\left(n\omega +\phi \right)\right]$$.

I think the $$E\left[x\left(n\right)\right]\:=0$$ regardless of the random variables just because of the periodicity of the cosine sequence.

Now I would also like to find the auto-correlation function

$$R\left(n,k\right)=\:E\left[x\left(n\right)x\left(n+k\right)\right]=A^2E\left[cos\left(n\omega +\phi \right)cos\left(\left(n+k\right)\omega \:+\phi \:\right)\right]=\frac{A}{2}^2\left\{E\left[cos\left(2\left(n\omega +\phi \right)+k\omega \right)\right]+E\left[cos\left(k\omega \right)\right]\right\}=\frac{A}{2}^2cos\left(k\omega \right)$$

I am not sure if am solving this the right way, can somebody please tell me if am doing something wrong? because I think the random variables must have a role in this

• yes, that looks correct to me. Apr 4, 2021 at 2:38

The "periodicity of the cosine" has little to do with the matter at hand. Indeed, unless $$\omega/\pi$$ is a rational number, it is not even the case that the discrete-time sequence $$x[n] = A\cos(n\omega + \phi)$$ is a periodic sequence at all. See, for example, this question which asks "Why is $$\cos\left(\frac n6\right)$$ aperiodic?" Now, coming to the meat of the question and correcting meaning-less notation such as $$\omega \in [\omega-\lambda,\omega+\lambda]$$ to $$\omega \in [\omega_0-\lambda,\omega_0+\lambda]$$, we have from LOTUS, the law of the unconscious statistician, that $$E\left[x[n]\right] = E[A\cos(n\omega + \phi)] = A \int_{-\pi}^{\pi}\int_{\omega_0-\lambda}^{\omega_0+\lambda}\cos(n\omega + \phi)f_{\omega,\phi}(\omega,\phi)\, \mathrm d\omega \,\mathrm d\phi \tag{1}$$ where $$f_{\omega,\phi}(\omega,\phi)$$ is the joint density of $$\omega$$ and $$\phi$$. The OP has not stated that $$\omega$$ and $$\phi$$ are independent random variables, but if they are assumed to be independent (as is most likely the intention), then the joint density in $$(1)$$ factors into the product of the marginal densities (which are given to be uniform on $$[\omega_0-\lambda,\omega_0+\lambda]$$ and $$[-\pi,\pi]$$ respectively,) and so $$(1)$$ can be written as $$E\left[x[n]\right] = A \int_{-\pi}^{\pi}\frac{1}{2\pi}\left[\frac{1}{2\lambda}\int_{\omega_0-\lambda}^{\omega_0+\lambda} \cos(n\omega + \phi) \, \mathrm d\omega\right] \,\mathrm d\phi. \tag{2}$$ Similarly, the autocorrelation function is given by $$E\left[x[n]x[m]\right] = A \int_{-\pi}^{\pi}\frac{1}{2\pi}\left[\frac{1}{2\lambda}\int_{\omega_0-\lambda}^{\omega_0+\lambda} \cos(n\omega + \phi)\cos(m\omega + \phi) \, \mathrm d\omega\right] \,\mathrm d\phi. \tag{2}$$
• (That's a pretty common confusion to have: you're not calculating a time average; the time is fixed as $m,n$. You're calculating an expectation at that time. See also: ergodicity (which isn't given here))