# Smoothing PSD plot

I am currently working with a signal, and I am interested in plotting its spectra. I have used python, I have computed the signal values, and I have an array that has the time-series values of the signal.

Using the periodogram function from the signal library I am able to compute the power spectra, but when plotting the spectrum against the frequencies, the graph is not smooth.

I would like to have a smooth graph, and from some of the research I've been doing I think applying a filter is needed, however I am not sure what filter I should be using and I would like some information.

• "I would have to have a smooth graph": Why? (there's valid reasons, for example if you know something about the signal you don't tell us, when your observation is short etc, but in general:) Making a plot look like you want it to is kind of like lying with data... Mostly, however, the method of scaling would always depend on the usage of the spectrum afterwards, i.e. how you smooth something depends on why you smooth it. May 19, 2020 at 18:54
• As an alternative to the periodogram you could try to use Welch's method to estimate the power spectral density of your signal. It's basically a smoothed version of the periodogram and is available in Python in the SciPy library. May 19, 2020 at 19:04

Using scipy.signal.filtfilt is often a good choice for post processing such as smoothing plots due to its zero delay (a non zero delay filter in contrast will create a frequency shift given the sample delay induced from input to output that would otherwise need to be compensated for).
out = scipy.signal.filtfilt([1,1,1,1,1],5, sig)