I'm trying to suppress the sidelobe of OFDM but having troubles showing its spectrum in Matlab. After IFFT, I get a time-domain signal, but in which way I can get its spectrum(or PSD)? I want to analyze the out band power emission, with rectangle window in the time domain the out of band power curve decrease slowly, so it may interference the adjacent channel user, to avoid that situation we have to apply some algorithms to suppress the out of band power emission caused by the sidelobe of OFDM signal. After apply the algorithm I have to plot some figures to demo the effect of my algorithm, so I need the whole PSD of OFDM signal and I also want the out of band part become more steep. I tried to use FFT and pwelch function of Matlab, but never get what I want. I doubt if I use them in right way. So I'm hoping someone here can help me. I know it's basic, but it really obsess for a long time. I analyze the baseband signal, so it should be after the IFFT operation.The figure that I want is below. OFDM spectrum spectrum 2

My matlab code:

  N = 64;
  over_sample_factor = 2;
  M = N*over_sample_factor;
  Mod = 16;
  symbol = 1;
  bitlength = N*log2(Mod)*symbol;
  itr_num = 1000;
  fft_len = 2*M;
  signal_freq = zeros(itr_num,fft_len);
  for itr = 1:itr_num
      bit_data = randi([0,1],bitlength,1);
      h = modem.qammod('M', Mod, 'SymbolOrder', 'Binary', 'InputType', 'Bit');
      zp_before = modulate(h,bit_data);
      after_zp = zeros(1,M);
      after_zp(1:N/2) = zp_before(N/2+1:N);
      after_zp(M-N/2+1:M) = zp_before(1:N/2);
      ofdm_symbol = ifft(after_zp);
      signal_freq(itr,:) = abs(fft(ofdm_symbol,fft_len)).^2; 
  PSD_mean = mean(signal_freq,1);

The figure is like this spectrum 3

  • $\begingroup$ What do you want? To see the sidelobes you have to plot the PSD of the "analog" signal, that is to say of an oversampled version of the IFFT output. The PSD will therefore also depend on the pulse shaper you're using. A rectangular impulse is a good start, it models an digital-to-analog converter. $\endgroup$
    – Deve
    Commented Dec 12, 2013 at 7:57
  • $\begingroup$ Thanks, Deve. Do you mean oversampling is essential to plot the PSD? I know oversample means insert '0' in the center of symbols that will be modulated and do a longer ifft, but I don't know why it's been called oversample, it's not like an usual oversample I've learned. And I wonder what oversample ratio is sufficient to plot the PSD. I'm using a rectangle pulse, why do you say it models a DAC? $\endgroup$
    – rayoung
    Commented Dec 12, 2013 at 12:55
  • $\begingroup$ It was not exactly clear to me what you'd like to analyze. Maybe you can rephrase your question. If you directly apply an FFT to the IFFT output you can estimate the spectrum from $-f_s/2$ to $f_s/2$. If you'd like to analyze spectral components beyond that bandwidth you'll have to use a higher sampling frequency, thus my suggestion to apply oversampling. In a complete comm. system, at what point would you like to analyze the OFDM spectrum? $\endgroup$
    – Deve
    Commented Dec 12, 2013 at 15:43
  • $\begingroup$ Deve, I've rephrased my question, I think it's clear this time. $\endgroup$
    – rayoung
    Commented Dec 16, 2013 at 6:07
  • $\begingroup$ Please show us some code snippets and/or figures. Define "whole" PSD - what bandwidth would you like to analyze? At what point in the comm. system would you like to analyze the OFDM spectrum? After IFFT, after DAC, after transmit filter? $\endgroup$
    – Deve
    Commented Dec 16, 2013 at 8:35

2 Answers 2


If you are looking at the sidelobes in particular then you will probably want to oversample, as Deve mentioned. x2 oversampling should be sufficient, but you can do more if you want. I generally plot my FFT's as follows to get the energy in a dB scale (Matlab syntax)-


or, to center the FFT visually-


I see two differences between your PSD plot and those from the reference you have given

  1. The PSD is normalized to the mean power of the data subcarriers
  2. The PSD is "smoother"

In order to obtain a similar result

  1. Calculate the mean of the PSD at the data subcarriers and divide the PSD by this value
  2. "Bin" your PSD, i. e. take the mean of every $N$ PSD values to create a "smooth" version of the original PSD

By adding the following lines to your code...

plot(linspace(-1,1,fft_len), fftshift(10*log10(PSD_mean)));
hold on;

mean_sig_power = mean([PSD_mean(1:N/2) PSD_mean(fft_len-N/2+1:fft_len)]); % mean power of data subcarrierse
PSD_mean = fftshift(PSD_mean);  
bin_length = 2;
num_bins = floor(fft_len / bin_length);
PSD_smooth = zeros(1, num_bins);
for k = 1:num_bins
  PSD_smooth(k) = mean(PSD_mean((k-1)*bin_length + 1 : k*bin_length));
hold off;
ylim([-35 12]);
grid on;
legend('yours', 'theirs');

...I've created the following plot...

PSD of OFDM signal

...which I think looks quite similar to your references.

  • $\begingroup$ Thanks for the post, was of great use to me. Can you indicate some bibliography explaining how to make this kind of application in MATLAB with OFDM too? Thanks. With all regards, Flávio Sampaio $\endgroup$ Commented Feb 1, 2017 at 2:42

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