Added routine to calculate the power spectral density.