1
$\begingroup$

I've been implementing a Welch method FFT and I am trying to work out the correct scaling factor that should be applied to the output of the function so the PSD is accurate because at the moment it's too low.

I am using scipy, signal.welch.

I know what the Power per resolution from a measurement of my signal and ive also calculated manually. I also know my manual calculation is correct because a straight forward FFT produces power around what I calculate but it fluctuates wildly across frequency (+ - 4 dB along what visually appears to be the average in the signal bandwidth).

So I needed a Welch method for a better spectral estimation. However this Welch method output it needs to be shifted vertically in dB. Meaning there must be a scaling factor applied.

Would anyone be able to say what it should be, perhaps the scaling factor varies with fftsize, percent of overlap, length of each segment etc?

Many thanks for your help

$\endgroup$
4
  • 1
    $\begingroup$ What do you mean by "correct" ? What's your calibration, goal, or reference ? $\endgroup$
    – Hilmar
    Mar 21 at 23:05
  • $\begingroup$ @Hilmar I manual calculate the PSD of my signal, and its not what the output of the Welch method function produces. I know my manual calculation is correct because a straight forward FFT produces power around what I calculate but it fluctuates wildly. So I needed a Welch method for a better spectral esimation. However this welch method output it needs to be shifted vertically in dB. Meaning there must be a scaling factor applied. $\endgroup$ Mar 22 at 13:41
  • $\begingroup$ I'm not sure about this either. Fromf, Pxx_spec = welch(sig, fs, 'flattop', nperseg=N, scaling='spectrum'), I use 20*np.log10(np.sqrt(2)*np.sqrt(Pxx_spec) to get dBFS levels for tones, if that's at all helpful. It's unaffected by nperseg and window. $\endgroup$
    – endolith
    Mar 28 at 1:24
  • $\begingroup$ @endolith Yes your right that gives what I was expecting... Hmm. I was using scaling = 'density' and then going with 10log10 to convert the output density to dB but i must have making a silly mistake with something. I will look into it, but thankyou. $\endgroup$ Apr 9 at 6:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.