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.