I am trying to plot the power spectral density (PSD) of an OFDM signal with $N_{dsc}$ subcarriers and $N_{zeros} = N_{fft}-N_{dsc}$ zero subcarriers.

I am using the matlab function pwelch() to plot the PSD. However, every time I change $N_{fft}$ or equivalently $N_{zeros}$, the PSD plot shifts. I was wondering why does this happen? In the plots, I align the the PSD curves for different $N_{fft}$ to show the shift in PSDs. The trend is, the PSD enter image description heredecreases (also the power decreases) with increasing $N_{fft}$ (i.e. higher sampling frequency in time). I am wondering why the PSD curves would shift or the power would change.

clear all
Nsymbols = 100;% Total number of OFDM symbols
Bandwidth = 50e6;
Ndsc = 990; 
SCS = Bandwidth/Ndsc;

NfftOriginal = 1024;% Original FFT size
SamplingRateOriginal = NfftOriginal * SCS; % 
OSR_set = [2 4 8];
for l = 1:length(OSR_set)
%% Oversample to see wider spectrum than nyquist
OSR = OSR_set(l);%  %Oversampling parameter     
SamplingRate = SamplingRateOriginal*OSR; % New sampling rate
Nfft = SamplingRate/SCS;%FFT size with oversampling
Nzeros = Nfft - Ndsc;
psd = zeros(1,Nfft);
for k = 1:Nsymbols
% Generate random data block.
M = 4; %Modulation order
x = randi([0 M-1],1,Ndsc);
inputSymbols = qammod(x,M);

%% Create OFDM symbols
rr1 = 1:Ndsc/2;rr2 = Ndsc/2 +1:Ndsc;
if Nzeros~=0
inputSymbols  = [0 inputSymbols(rr2) zeros(1,Nzeros-1) inputSymbols(rr1)];
inputSymbols  = [0 inputSymbols(rr2) inputSymbols(rr1)];

ofdmSymbol = ifft(inputSymbols,Nfft);

window= [];   
[P_Hz,W] = pwelch(ofdmSymbol,window,[],Nfft,SamplingRate);  

psd(k,:) = P_Hz;

f = [-Nfft/2:Nfft/2-1]*SamplingRate/Nfft/1e6;
PSD = mean(psd);
power = sum(PSD)*SCS
plot(f,10*log10(fftshift(PSD))+(0-10*log10(max(PSD))), 'LineWidth',1);
hold on
xlabel('Frequency [MHz]')
ylabel('PSD [dBW/Hz]')
  • $\begingroup$ Please provide your code so we can help you $\endgroup$ – MaximGi Apr 7 at 20:07
  • $\begingroup$ Hi @MaximGi Thanks for your quick reply! I have added the code and edited my question. $\endgroup$ – user2852959 Apr 8 at 4:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.