PWELCH vs PSD

Technical Source
2 min readDec 31, 2020

--

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?

ANSWER

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

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.

SEE COMPLETE ANSWER CLICK THE LINK

https://www.matlabsolutions.com/resources/pwelch-vs-psd.php

--

--

Technical Source
Technical Source

Written by Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

No responses yet