# Help with obtaining the power spectral density of a simple continuous cosine (using both forms of the definition for PSD)

I am trying to go through a simple example to teach myself about Parseval's theorem and calculating power spectral density (PSD) in practice and would be very grateful if someone could check my reasoning and help my understanding.

Specifically, I want to calculate the average power of a signal in the time domain and show that it is equal to the average power obtained in the frequency domain using the PSD (according to Parseval).

As an example, I am considering a simple cosine (non-causal) signal $$x(t) = A\cos(2\pi f_0t)$$, which should have infinite energy but finite average power (known as a "power signal", as opposed to "energy signal") given by: $$P_{\textrm{av}} = \lim_{T\to\infty}\frac{1}{T} \int^{+T/2}_{-T/2} |x(t)|^2\mathrm dt$$

Since this signal is periodic, I should be able to calculate the average power by considering a single period only, where $$T= 1/f_0$$, $$P_{\textrm{av}} = \frac{1}{T} \int^{+T/2}_{-T/2} |A\cos(2\pi f_0t)|^2\mathrm dt = f_0 A^2 \int^{+T/2}_{-T/2} \frac{1}{2}\Big[1+\cos(4\pi f_0 t) \Big]\mathrm dt = \frac{A^2}{2}$$

I would now like to arrive at this result by integrating the power spectral density over all frequencies (as should work by Parseval), to convince myself of what I'm doing. So first, I need to obtain the power spectral density. I have seen one definition of the PSD given as the Fourier transform of the autocorrelation function, $$R(\tau)$$, so I first calculate this:

\begin{align} R(\tau) &= \int^{+\infty}_{-\infty} x(t+\tau)\;x^*(t)\;\mathrm dt \\ &= A^2 \int_{-\infty}^{+\infty} \cos(2\pi f_0(t+\tau))\cdot \cos(2\pi f_0)\; \mathrm dt\\ &= \frac{A^2}{2} \cos(2\pi f_0\tau) \end{align}

where I have used trigonometric identity to evaluate the integrals. Now, calculating the Fourier transform of this to get the PSD:

\begin{align} \textrm{PSD}(f) &= \mathcal{F}\{R(\tau)\} \\ &= \int_{-\infty}^{+\infty} R(\tau) e^{-2\pi i f \tau}\; \mathrm d\tau\\ &= \int_{-\infty}^{+\infty} \frac{A^2}{2} \cos(2\pi f_0\tau) e^{-2\pi i f \tau}\; \mathrm d\tau\\ &= \frac{A^2}{4}\Big[ \delta(f-f_0) + \delta(f+f_0) \Big] \end{align}

Is this correct for the power spectral density of a cosine wave, i.e. in units of [signal$$^2$$ per Hz]? It does indeed look like if I were to integrate this PSD over frequency I would get the correct average power $$P_\textrm{av} = A^2/2$$.

I have seen an alternative (or just different form?) of the definition of PSD in this question:

$$S_{xx}(\omega)=\lim\limits_{T\to \infty}\mathbf{E} \left[ | \hat{x}_T(\omega) |^2 \right]$$

How would I apply this definition to my cosine signal to arrive at the same PSD above, and show that the average power is recovered? Which method is the approach I should take? Is it true that the autocorrelation method is used more for stochastic signals when the FT does not exist, and for deterministic signals (such as in my case) we can directly use the FT?

There are several misconceptions in the question that have not been addressed in the existing answers. First of all, the signal $$x(t)=A\cos(2\pi f_0t)$$ is a deterministic power signal (unless $$A$$ or $$f_0$$ are modeled as random variables). For this reason several definitions in the question are inappropriate. First, the auto-correlation of a power signal is given by

$$R_x(\tau)=\lim_{T\to\infty}\frac{1}{2T}\int_{-T}^Tx^*(t)x(t+\tau)dt\tag{1}$$

The integral given in the question (with infinite limits and without division by $$T$$) does not exist for the given $$x(t)$$. With definition $$(1)$$, the auto-correlation of $$x(t)$$ is indeed obtained as

$$R_x(\tau)=\frac{A^2}{2}\cos(2\pi f_0\tau)\tag{2}$$

The Fourier transform of $$(2)$$ results in the power spectrum of $$x(t)$$.

The power spectrum can also be computed directly from $$x(t)$$, but the formula given in the question only applies to random signals, but not to deterministic signals. For deterministic signals, the appropriate definition is

$$S_x(f)=\lim_{T\to\infty}\frac{1}{2T}\left|\int_{-T}^{T}x(t)e^{-j2\pi ft}dt\right|^2\tag{3}$$

The computation of $$(3)$$ for the given signal is discussed in this question.

• Thanks Matt, I completely agree with everything you say. At the time I asked the question I was not aware of these distinctions in definition, but have learnt a lot in the last couple of weeks! Commented Apr 11, 2020 at 13:00
• @MattL given this, do you think the answer I provided is incorrect or just the details in the question? Commented Oct 7, 2020 at 4:02
• @DanBoschen: It partly depends on your definition of the expectation operator. The definition I know is applicable to random signals. For deterministic signals, according to that definition, the expectation of a signal just equals the signal itself. Furthermore, defining the integration limits as $0$ and $T$ and letting $T\to\infty$ only works for causal signals. For general signals we have to define the limits as in Eqs (1) and (3) in my answer. Commented Oct 7, 2020 at 6:52
• @DanBoschen Done. Matt's answer really highlighted the fact that there are different definitions, which I did not appreciate when first asking the question. However, your answer was still helpful with the practicalities of evaluating these sorts of expressions. Commented Oct 8, 2020 at 8:56
• @rainman: Yes, those two terms usually mean the same thing. Commented Nov 18, 2023 at 14:32

Starting with from the linked question: $$S_{xx}(\omega)=\lim\limits_{T\to \infty}\mathbf{E} \left[ | \hat{x}_T(\omega) |^2 \right]$$ $$= \lim\limits_{T\to \infty}\mathbf{E} \left[ \frac{1}{T} \int\limits_0^T x^*(t) e^{i\omega t}\, dt \int\limits_0^T x(t') e^{-i\omega t'}\, dt' \right] = \lim\limits_{T\to \infty}\frac{1}{T} \int\limits_0^T \int\limits_0^T \mathbf{E}\left[x^*(t) x(t')\right] e^{j\omega (t-t')}\, dt\, dt'$$

And for the OP's $$x(t)$$ given as:

$$x(t)=A\cos(2\pi f_o t) = A\cos(2\omega_o t)$$

$$= \lim\limits_{T\to \infty}\frac{1}{T} \int\limits_0^T \int\limits_0^T \mathbf{E}\left[A\cos(\omega_o t) A\cos(\omega_o t')\right] e^{j\omega (t-t')}\, dt\, dt'$$

The expected value of the product of the cosine functions reduces to $$\frac{A}{2}$$ as follows:

$$\mathbf{E}\left[A\cos(\omega_o t) A\cos(\omega_o t')\right]$$

$$= \mathbf{E}\left[\frac{A^2}{2}\cos(\omega_o (t+t')) + \frac{A^2}{2}cos(\omega_o (t-t'))\right]$$

Setting $$t-t' = \tau$$ then for each value of $$\tau$$ the expected value reduces to:

$$= \mathbf{E}\left[\frac{A^2}{2}\cos(\omega_o (2t-\tau)) + \frac{A^2}{2}cos(\omega_o \tau)\right]$$

$$=\frac{A^2}{2}\cos(\omega_o \tau)$$

And therefore the limit as a function of $$\tau$$ becomes:

$$= \lim\limits_{T\to \infty}\frac{1}{T} \frac{A^2}{2}\int_0^T \cos(2\pi f_o \tau) e^{j2\pi f\tau}\, d\tau$$

Since $$\cos(2\pi f_o \tau)$$ is periodic for all time, we can consider T that is over one complete period $$T=\frac{1}{f_o}$$ and expand cos with Euler's identity to get:

$$S_{xx}(f) = \frac{1}{T} \frac{A^2}{4}\int_{\tau=0}^T \bigg(e^{-j2\pi f_o \tau}+e^{j2\pi f_o \tau}\bigg) e^{i2\pi f \tau}\, d\tau$$

The above integral resolves to $$T$$ when $$f=f_o$$ or when $$f=-f_o$$ and $$0$$ for all other $$f$$, thus for these values of $$f$$, $$S_{xx}(f) = \frac{A^2}{4}$$.

Which is the same result as given by the equation (specifically the same power quantity when integrating over $$f$$ since $$S_{xx}(f)$$ is a density):

$$\frac{A^2}{4}\bigg[\delta(f-f_o) + \delta(f+f_o)\bigg]$$

• How did you perform the last step, exactly? I know the Fourier transform of the cosine is a standard thing, but how did you handle the limit T to infinity? Commented Mar 31, 2020 at 19:16
• @teeeeee I added more details - Commented Mar 31, 2020 at 19:57
• Okay I see, you use the fact that the PSD over a single period is the same as the PSD of the entire non-truncated signal. I wasn't sure if it was possible to carry out the integral for some general $T$, and then at the very end see what happens when you take that $T$ value to infinity. If you know how to do this I would appreciate that as well, but I will accept the answer anyway because you answered my original question! Thanks Commented Mar 31, 2020 at 20:11
• I think you have to go through a full understanding of the impulse function, it’s purpose and peculiarities first and specially why it allows for the Fourier Transform to exist when it otherwise wouldn’t due to those singularities on the axis that would make the result go to infinity. I believe it is well covered on other questions but then will allow you to “juggle” the equations more when those come up in the solutions. Commented Mar 31, 2020 at 20:28
• That would make a good new question! Commented Apr 1, 2020 at 16:35

That seems fine. If you integrate your PSD over all frequencies you get a $$1$$ at $$-f_0$$ and $$+f_0$$ and zero everywhere else. $$1+1 = 2$$ so the total integral will come out to be $$A^2/2$$ which matches your time domain number.

Yes, the PSD is also the magnitude squared of the Fourier Transform, i.e. $$PSD(f) = X(f) \cdot X^*(f)$$

where $$X(f)$$ is the Fourier Transfrom of $$x(t)$$ and $$*$$ the complex conjugate operator.

• Thanks, I understand your definition written. However, in the definition I gave, I am concerned about how to rigorously handle the $T\to\infty$ and the expectation operator, as well as the fact that the Fourier transform used is a truncated version $x_T$. Commented Mar 25, 2020 at 16:15
• It looks to me like your definition is wrong. The units of PSD should be $[\textrm{signal}^2 / \textrm{Hz}]$. However, because the units of $X(f)$ are $[\textrm{signal} \cdot \textrm{sec}]$, then the units of $|X(f)|^2$ in your definition are actually $[\textrm{signal}^2 \cdot \textrm{sec} / \textrm{Hz}]$. This is actually the units of energy spectral density, not power spectral density? Commented Mar 26, 2020 at 9:47