3

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?

Peter Mortensen
  • 219
  • 1
  • 8
teeeeee
  • 681
  • 6
  • 17

3 Answers3

4

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.

Matt L.
  • 89,963
  • 9
  • 79
  • 179
  • 1
    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! – teeeeee Apr 11 '20 at 13:00
  • @MattL given this, do you think the answer I provided is incorrect or just the details in the question? – Dan Boschen Oct 07 '20 at 04:02
  • 1
    @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. – Matt L. Oct 07 '20 at 06:52
  • @teeeeee Not that mine is necessarily incorrect but I think Matt’s answer here is really the better one and more insightful; if you agree, it is possible to change the one that is selected as the best answer. Might be better for future readers – Dan Boschen Oct 07 '20 at 13:04
  • 1
    @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. – teeeeee Oct 08 '20 at 08:56
  • Is the power spectrum $S_x(f)$ also called the ‘power spectral density’? – rainman Nov 18 '23 at 01:26
  • 1
    @rainman: Yes, those two terms usually mean the same thing. – Matt L. Nov 18 '23 at 14:32
2

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]$$

Dan Boschen
  • 50,942
  • 2
  • 57
  • 135
  • 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? – teeeeee Mar 31 '20 at 19:16
  • @teeeeee I added more details - – Dan Boschen Mar 31 '20 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 – teeeeee Mar 31 '20 at 20:11
  • I think I do as generally it should be a Sinc function for a general window of T so we would get Sinc functions instead of impulses which interestingly converge to impulses as T goes to infinity. I am still bothered however that the FT has this same result without the 1/T factor but (kind of) see the difference—- with impulses the value is actually infinity at those frequencies but when you integrate over them the area of each impulse is 1 giving the desired result — the solution here is giving the result directly so is not actually an impulse but the same answer as you integrate. – Dan Boschen Mar 31 '20 at 20:17
  • So may require additional limits to show how they converge to the same answer as you take integrations over delta f as delta f approaches zero around those impulse locations – Dan Boschen Mar 31 '20 at 20:18
  • Yes, I also found Example 10.1 here https://www.sciencedirect.com/topics/computer-science/power-spectral-density . This says pretty much what you just described, albeit with some sloppy notation. I think it may be a little too tricky for me to be able to do carefully. I wanted to see something which, when you take the T infinity limit, allows the PSD you derived to fall out. – teeeeee Mar 31 '20 at 20:24
  • 1
    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. – Dan Boschen Mar 31 '20 at 20:28
  • Another question, sorry! The equation you give right after you write: "Setting $t−t′=\tau$ then for each value of $\tau$ the expected value reduces to:". This equation doesn't look correct if you make that substitution? It doesn't follow from the previous line? – teeeeee Apr 01 '20 at 15:19
  • Thank you! You are correct, should be $2t-\tau$ which still evaluates to 0 but I fixed that. – Dan Boschen Apr 01 '20 at 15:55
  • Thanks, that's fine now, but I then don't understand the next line. Lets say that the function inside the expectation is completely deterministic, then the expectation value of the function is just the function itself (https://dsp.stackexchange.com/a/50228/38419). So how do you arrive at the next line which says $A^2/2\cdot\cos(\omega_0\tau)$? Are you saying that the first term is always zero, even in absence of the expectation? Thanks so much again for your patience! – teeeeee Apr 01 '20 at 16:00
  • The first term is zero because of the expectation, as the expectation is done by integrating over the variable $t$ and the result is an equation on $\tau$. The expected value of any sinusoid that is a variable of t ($cos(\omega t)$) is 0. The thing we did here was make it a condition that we are interested in the difference of the two times given (t and t') rather than having them both completely independent, so we sweep time $t$ for each different $\tau$ and get a function of $\tau$. This is the reason that wide-sense stationarity is assumed. – Dan Boschen Apr 01 '20 at 16:03
  • Okay so something is still not quite right. I think for completely deterministic signals you can define the PSD without the expectation operator (see this answer https://dsp.stackexchange.com/a/65992/38419), because the expectation is just the value directly. If we try to run through the derivation above without the expectation operator, then there is still the problem that the $\cos(2t-\tau)$ remains. In that case, you still have your double integral over $dt$ and $d\tau$. How can we reconcile that? – teeeeee Apr 01 '20 at 16:13
  • Since it is a sum under the expectation you can split the expectation into two parts, right? – Dan Boschen Apr 01 '20 at 16:15
  • No, I'm saying if you didn't use the definition with the expectation to start with (which should not be required for deterministic signals anyway), the one given in my link. It is exactly the same as the one you began with, but just without the expectation. – teeeeee Apr 01 '20 at 16:19
  • This was actually asked before https://dsp.stackexchange.com/questions/62946/the-expectation-in-power-spectral-density and it seems from the answer that indeed the expectation is not need for deterministic signals. – teeeeee Apr 01 '20 at 16:23
  • Yes but still works to include it, right? For deterministic signals the expectation is the average. – Dan Boschen Apr 01 '20 at 16:24
  • Yes, if you include the expectation it works (as you have proven above). But if you don't include it, as given by the definitions in the links I provided, then it seems like it doesn't work because the cos term remains. The other definitions don't seem to contain an average, they are simply $$S_x(\omega)=\lim_{T\rightarrow\infty}\frac{1}{T}\left| \int_{-T/2}^{T/2}x(t)e^{-j\omega t}dt \right|^2 $$ – teeeeee Apr 01 '20 at 16:27
  • I can't make it work with that definition. – teeeeee Apr 01 '20 at 16:28
  • 1
    That would make a good new question! – Dan Boschen Apr 01 '20 at 16:35
0

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.

Hilmar
  • 44,604
  • 1
  • 32
  • 63
  • 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$. – teeeeee Mar 25 '20 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? – teeeeee Mar 26 '20 at 09:47