MATLAB: How to scale PSD/Pwelch highest point to 0dB

communicationsfrequencyofdmpsdsignalspectrum mask

Hi,
I am currently using the pwelch function to simulate the spectrum of an OFDM signal.
Note: I used random numbers, QPSK modulation, zero padding and finally IFFT to obtain my OFDM signal.
fsMHz = 80;
Len = length(ofdm_signal);
[Pxx,f] = pwelch(ofdm_signal,[],[],Len,fsMHz);
plot([-(Len/2):((Len/2)-1)]/1024,10*log10(fftshift(Pxx)));
Resulting in:
As you can see on the PSD axis, the highest point is at around -50dBr.
I also did some calculations and I came up with the following:
Re = real(ofdm_signal); % Real part of the signal.
Im = imag(ofdm_signal); % Imaginary part of the signal.
Power = Re.*Re+Im.*Im; % Calculating Power.
AvgP = sum(Power)/Len; % Calculating Average Power.
AvgP_db = 10*log10(AvgP); % Average Power in dB.
PeakP = max(Power); % Calculating Peak Power.
PeakP_db = 10*log10(PeakP); % Peak Power in dB.
PAPR_db = 10*log10(PeakP/AvgP); % PAPR in dB.
disp(['Average Power1 = ' num2str(AvgP)]);
disp(['Average Power1 (dB) = ' num2str(AvgP_db)]);
disp(['Peak Power = ' num2str(PeakP)]);
disp(['Peak Power (dB) = ' num2str(PeakP_db)]);
disp(['PAPR (dB) = ' num2str(PAPR_db)]);
Which resulted in:
Average Power = 0.00024414
Average Power (dB) = -36.1236
Peak Power = 0.0020307
Peak Power (dB) = -26.9235
PAPR (dB) = 9.2001
What I want to know is whether there is a way to scale that PSD axis so that the highest point is around 0dB, as frequently used in theory. Here are some pictures of what I'm trying to do.
Please help me out here.
Looking forward to your answers.

Best Answer

You just need to normalize it, for example
plot([-(Len/2):((Len/2)-1)]/1024,10*log10(fftshift(Pxx/max(Pxx))));
and
AvgP_db = 10*log10(AvgP/max(AvgP))
Related Question