Question
I am trying to update some code that uses the deprecated function PSD to use PWELCH instead; however, I am getting completely different results when I am using what seems to be the same parameters. Does anyone know why? Here are what I believe to be the equivalent function calls: [pxx,f] = pwelch(data, hanning(1024), [], 1024, 250); [pxx,f] = psd(data,1024,250,hanning(1024)); Where: data = signal in a vector hanning(1024) = window vector 1024 = nfft, number of points in the fft 250 = Fs, the sampling rate [ ] = noverlap, defaults to 50% window overlap Matlab has removed all help information for the PSD function, and instead says to use its functional equivalent pwelch, so I don't have anyway of looking up what the original documentation says about the function's inputs and outputs. Could the outputs be scaled differently? Is the PSD calculated differently between the two functions?
Related Questions
Expert Answer
Neeta Dsouza
PhD Expert
Answered Aug 25, 2026
The result of psd is not correctly scaled, therefore you should use pwelch. For spectral density, the result should be scaled by the sampling frequency, which is not performed by psd.
If you look at the two results, the f vector should be the same. If you take the ratio of two pxx, you can that most samples, the differ by a factor of 125, which is basically half of sampling frequency. This is because the resulting spectrum is one-sided. The two end points differs by a factor of 250. This is due to the fact that these two points correspond to DC and Nyquist frequency and should not be doubled even if it's one-sided.
BTW, for your case, there is really no overlap happening because your data and window length are the same.
Have a different question? Ask here