Asked by Rohan
on 7 Dec 2012

I want to understand the difference between the following two methods to calculate the PSD:

1. Using periodogram; First finding auto correlation of a sequence and then taking FT of the auto correlation.

2. Calculating the Fourier Transform of a signal directly and then squaring it to get the power corresponding to the frequency bins.

Why go in for method (1) which involves auto-correlation and then the Fourier Transform when method (2) ought to give the same result with the need for auto-correlation.

My take on the question: Calculating auto-correlation brings out the global frequency variations of the signal so the PSD here would give a pronounced peak(s) for global variations whereas the square of FT of signal method does not do this.

However, in the event that what I said is true, then the 2 methods do not provide the exact same info and in that case both of them should not be called PSD of the signal.

*No products are associated with this question.*

Answer by Wayne King
on 7 Dec 2012

The PSD is the Fourier transform of the autocorrelation. But right out of the box, you can only estimate the autocorrelation sequence.

If you use the biased estimate of the autocorrelation, you can easily show that is proportional to the squared-magnitude of the DFT of the original sequence. You can see that basic equivalence here.

Fs = 1000; t = 0:0.001:1-0.001; x = cos(2*pi*100*t)+randn(size(t)); xc = xcorr(x,'biased'); xcft = fft(xc); xdft = fft(x); pxx = 1/length(x).*abs(xdft).^2; subplot(211) plot(abs(xcft)) subplot(212) plot(pxx)

There are some caveats. For example, you notice that I had to use the absolute value of the autocorrelation. I should not have had to do that because the Fourier transform of the autocorrelation should be real-valued. But I can't trick MATLAB into knowing that I'm giving it an even sequence (symmetric with respect to 0 lag).

I think you're not correct to say that they do not provide the same information, they are in fact mathematically equivalent -- the periodogram and the Fourier transform of the biased autocorrelation sequence estimate. But you have to keep in mind the difference between what you can write down on paper and how to have to implement it in a computational tool like MATLAB, R, Python, etc.

Answer by Rohan
on 7 Dec 2012

I had a feeling that what you(^) said may not work with more complicated signals. But it does, as I tried it with PCG signals(heart sounds).

So, I still want to know why do we use the periodogram method to estimate PSD at all. Why not just take the FT and square it.

Is it because if we take auto-correlation, the signal is amiable to windowing and then calculating the average FT. This allows the variance, bias to reduce(generally).

Is this the motivation or rather explanation for the existence of Bartlett and Welch method for calculating the PSD.

@[Wayne King]

Answer by Wayne King
on 7 Dec 2012

Edited by Wayne King
on 7 Dec 2012

The periodogram is proportional to the magnitude-squared DFT. The scaling factors that make it not equal to the magnitude-squared DFT are precisely the factors that come from the derivation of the periodogram from the biased autocorrelation sequence and therefore are exactly what is needed to make the periodogram a PSD estimate.

The reason for using a modified periodogram (with a single window) is to mitigate a known problem called leakage that comes from the use of a rectangular window.

The Welch overlapped segment averaging method, which is very different from a modified periodogram, is to combat another (different) known problem with the periodogram and that is that the periodogram is not a consistent estimate of the true PSD. The variance of the periodogram does not go to zero even in the limit of an infinite sample size.

It should be noted that computer implementations of the autocorrelation sequence estimate like xcorr() typically use fft() under the hood, so my example above was in some sense "not fair", but the result would be the same if even if you wrote a routine that computed the autocorrelation sequence wholly in the time domain.

Answer by Rohan
on 7 Dec 2012

Umm... let me rephrase my previous question. I think it was not very clear:

Why bother with the periodogram route to find the PSD at all? Why not simply use the FT of the signal and square it. We get the same information either ways.

The periodogram route seems circuitous since we first take the auto-correlation and then the FT to arrive at the PSD.

I dont get why we need to do this at all when the more obvious(and simple) method of squaring the FT of the original signal exists. Am i missing some key point here?

The extra complication of the periodogram route to find the PSD has been developed over a long period of time and many different people have contributed to it. Why go through the trouble? There is obviously something I am missing. And I just cant seem to figure out what it is.

Can you pleas help me out @[Wayne King]. I would really appreciate it.Thanks:)

Wayne King
on 7 Dec 2012

The periodogram does NOT first use the autocorrelation sequence. The periodogram uses the DFT. It is not that the periodogram starts with the biased estimate of the autocorrelation sequence, it does not. I said that the periodogram and the Fourier transform of the (biased) autocorrelation sequence are mathematically equivalent.

The periodogram is proportional to the magnitude-squared DFT, but the scaling factors are precisely what are needed to make periodogram interpretable as a power spectral density (power per unit frequency)

Rohan
on 9 Dec 2012

The DFT of the auto-co-realated signal is carried out in the periodogram. So does that not make the starting point the autocorelation sequence(which has to be found out using the signal). After all, the periodogram is defined as the DFT of the autocorelation sequence.

@[Wayne King]

Teja Muppirala
on 11 Dec 2012

The DFT of the auto-co-realated signal is carried out in the periodogram.

This is not true. As Wayne said, the periodogram is **NOT** calculated using the autocorrelation (although it theoretically could be, since it contains the same spectral information as the original finite signal).

If you open up the PERIODOGRAM function in the editor and debug your way through it, you will see that nowhere does it calculate the autocorrelation first. In fact if you don't pass any special options, it simply just takes an FFT, squares the magnitude, folds it in half to collapse +/- frequencies, and then scales it appropriately.

After all, the periodogram is defined as the DFT of the autocorelation sequence.

I don't know if it's proper to say that that is the *definition*, but rather, that it is one *interpretation* or *equivalent formulation* for a means to estimate the power spectral density.

This link does a decent job of explaining it: http://www.ee.iitm.ac.in/~skrishna/ee471/dft_lab2.pdf

Opportunities for recent engineering grads.

## 0 Comments