In an earlier post, I showed how to compute power spectral density (PSD) of a discrete-time signal using the Matlab function pwelch. Pwelch is a useful function because it gives the correct output, and it has the option to average multiple Discrete Fourier Transforms (DFTs). However, a typical function call has five arguments, and it can be hard to remember how to set them all and how they default.
In this post, I create a simplified PSD function by putting a wrapper on pwelch that sets some parameters and converts the output units from W/Hz to dBW/bin. The function is named psd_simple.m, and its code is listed in the appendix.