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);
%pwelch(data,segmentLength,overlappedSamples,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