Day 3: Power Spectral Density Overview
In our last post we introduced the two main characters in this story of spectrogram. On one end we have Welch’s method (pwelch) on the other end we have the Thomson multitaper method (pmtm). As promised here is a
awful basic breakdown of why is more than one way to compute power spectral density (in fact there are several, far more than the two I’m talking about). So, let’s just dig right in!*
A short history of Welch’s method
A long, long time ago (okay, not that long ago, about 1967) a man named Peter Welch (hence Welch’s method!) found a way to improve on Bartlett’s method (I’ll give you a guess as to who came up with that). Bartlett used an averaged periodogram.
Aside: A periodogram is just a modified Fourier transform, the modification means it is optimized for unevenly time-sampled data. Really this method is brute-force and has been optimized since its invention (or rather discovery). If you haven’t read day one or don’t recall, the Fourier transform converts a signal from the time domain to the frequency domain. I will go over that in detail (eventually) so just know that going from the time domain to the frequency domain makes mathematical operations easier to do, which is why we use it.
Welch came along and improved on the periodogram method (and Bartlett’s method, since technically the periodogram method is distinct from Bartlett’s method). Welch’s method reduces noise in the estimate, but it does this by what amounts to averaging, so we lose frequency resolution. This trade off is one of the main reasons there are so many different methods!
Welch’s method splits the signal into overlapping segments (the amount of overlap you can choose, again at the cost of frequency resolution, if the overlap is zero, then technically you are using Bartlett’s method).
Next, the segments are windowed (in the time domain, this makes a difference believe it or not). This is a fancy way of saying that the center of the set is weighted higher than the edges (which is why we overlap them). This eliminates weird edge effects and discontinuities, more importantly the shape of these windows can be altered and as usual there isn’t a best practice.
Finally the periodogram is calculated (using the discrete Fourier transform) and those values are then averaged. In the end, we have an array of power measurement per per frequency (which is why the outputs for the code we’ve covered is given in pxx and f)
A (even shorter) history of Thomson’s method
Like Welch, a guy named David Thomson saw a new way to estimate the power spectrum of a signal. The problem was the Fourier transform, it assumes that each coefficient is a valid (or reliable) representation of the amplitude and phase of the corresponding component frequency. The issue is a statistics issue, you can’t take a very small sample size for a very large population and assume that your sample is a good representation of entire population (a quick example, if you take a glass of ocean water, you can’t say there aren’t any fish in the ocean just because your glass has no fish in it).
Instead of using an ensemble average (multiple averages of the signal), the multitaper method obtains multiple independent estimates from the same sample using orthogonal tapers (a type of window), hence the term multitaper method. These windows are selected (by definition) to minimise spectral leakage.. again with the leakage.
What all that means is that we can take multiple (and different) samples from the windowed signal to more accurately estimate the power of the frequencies in that window of signal.
So now that we’ve covered all of that background we can discuss what spectral leakage is, what a window is exactly, what a main lobe is (and side lobes), and while we’re at it we can discuss the meaning of life. Yeah it’s a lot, let’s just take it a little bit at a time, after all I’m going to be doing this for a year, might as well take my time to do it right… right?
See you all tomorrow!
*As always, I make no claim to the accuracy of this, I’m learning and you’re learning. If you see something that is not correct, or if you want to expand on something, please do. Let’s learn together!!