Im working on plotting the power spectral density of a random time series measured. I know the target spectrum.The idea is check the measurement vis-a-vis the target spectrum. However, I get slightly different plots for segment lengths of 128 & 256, its noisy for higher segment lengths. For 128 its a closer match. For 256 its smooth, but there is a slight bulge in the spectrum at the top (when compared to the target).

Im not sure which one to go with to validate the measuring device. Please advise.

Edit : 1. Hand sketch of the look of the plot added for 256 point segment length. 2. For 128 point, its more or less an exact match.PSD Hand Sketch

  • 1
    $\begingroup$ Have you tried averaging a few acquired spectra? (What does "top" mean? Low frequencies? High frequencies?) $\endgroup$
    – A_A
    Jun 22, 2018 at 14:33
  • $\begingroup$ I think adding plots here could potentially help a lot! $\endgroup$ Jun 22, 2018 at 14:51
  • $\begingroup$ 1. The shape of the PSD is a kind of inverted bell, by top I mean close to the peak. The starting edge is matching, but close to the top & the following edge look a bit extended when 256 segment length is used. 2. I will add the plots as soon as I get them, not on the computer Im using right now. $\endgroup$
    – Learner12
    Jun 22, 2018 at 15:41

1 Answer 1


The DFT in of itself is not a consistent estimator, or in other words, the variance of your transform doesn't decrease as the transform length increases.

Another way to think of it is that the DFT is a linear invertible transform, so whatever "information" is contained in the time domain is contained in the frequency domain. The segment that is 256 points is expected to be less smooth than a 128 point segment. If the longer segment has more variability, it's DFT will also have more variability.

To have a consistent estimator one can use the technique attributed to Welch, which means that you average a a set of DFT segments and that generally means averaging bin magnitudes (or magnitude squares).

Picking a correct segment length is related to how many segments you will average. The number of averages is often tied to the amount of data you can average, as well as a target bin variance.

If the data has a spectrum that varies, like a speech signal, one can average too much and obscure the dynamic nature of the data.

Window functions have a large influence on smoothness, and are implicitly related to segment length.

Without knowing what your target spectrum's purpose is, any notion of "correct length" will be subjective. Subjectivity isn't necessarily bad.

  • $\begingroup$ I have used the welch method. As you mentioned its the subjectivity part Im unable to tune into. The signal of interest here is a distance measurement - in the frequency range of less than 1 Hz and sampled at 5 Hz. The windowing function used is 'hanning'. $\endgroup$
    – Learner12
    Jun 23, 2018 at 5:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.