# Equivalence of the Power Spectral Density definitions

I am trying to show the equivalence of the following Power Spectral Density definitions in Matlab:

Definition 1:

$$P(\omega) = \sum_{k=-\infty}^{\infty} r(k)e^{-j\omega k}$$

Definition 2:

$$P(\omega) = \lim_{N\rightarrow\infty} E\left\{\frac{1}{N}\left|\sum_{n=0}^{N-1}{x(n)e^{-j\omega n}}\right|^2\right\}$$

So long as the following convergence property is satisfied:

$$\lim_{N\rightarrow\infty} \frac{1}{N} \sum_{k=-(N-1)}^{N-1}{|k||r(k)| = 0}$$

I have tried to demonstrate that if the convergence property above is not satisfied then the equivalence does not hold through a simulation in Matlab, however I have had no success. I have tried calculating both methods for the function $$y=x^2$$ which should clearly not satisfy the convergence property as well as $$y=sin(x)$$ which should also not. I have also found the estimated spectral density for white noise and it looks like the following:

I am not sure therefore if my method is correct, since surely the white noise spectral estimate should have been a flat line.

I hope that somebody can help me with this. Thanks.

• @MattL. I'm not entirely sure why you've marked this as a duplicate since the other question seems to be quite different. I am asking about simulation of the two definitions for different signals, and specifically, if an example can be found to demonstrate that if the convergence property is not satisfied then the definitions are not equivalent. – Resquiens Apr 1 at 19:51
• OK, I've retracted my close vote; I didn't notice the word 'Matlab' in the first sentence. The answers to the other question show the equivalence mathematically. – Matt L. Apr 2 at 7:16