I am trying to understand the difference between FFT magnitude and PSD (Power spectral density) with pwelch function of Matlab. In my example, Val1 and Val2 will output the same thing?

% N = 94144

% fs = 44100

segmentLength = N; % window size

[pxx,f] = pwelch(signal,segmentLength,[],segmentLength,fs);


Y = fft(signal);

Y_mag = abs(Y);

Val1 = 20*log10(Y_mag);

Val2 = 10*log10(pxx);

PS: I have already seen the other posts and I understand very well the difference between PSD and FFT but here I am interested in the diffeeence in code. Thanks


1 Answer 1


Pwelch does not just use one fft, it applies several ffts , windowing, scaling and averaging.If you do all that you may get equality.  Here is example equality of fft & pwelch:

N = 94144;
x = randn(1,N);
pwr1 = pwelch(x,ones(1,N),0,N,1,'twosided');
y = fft(x);
pwr2 = abs(y).^2;

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