I'm trying to simulate an OFDM signal that has been captured with a receiver that has a much larger bandwidth than the OFDM signal. I tried the following MATLAB code to simulate an OFDM signal that's 20% of the captured bandwidth and then demodulate it:

Nsymbol = 100;
M = 16;
Nfft = 128;
CPlen = 12;
% random bits...
in_bits = randi([0 1], log2(M), Nsymbol*Nfft);
% use a 16-QAM symbol constellation
symbols = qammod(in_bits, M, 'InputType', 'bit');
% reshape it ofdmmod
parallel_symbols = reshape(symbols, Nfft, Nsymbol);
baseband = ofdmmod(parallel_symbols,Nfft,CPlen);
% oversample by a factor of 5 and then decimate by a factor of 5 again
oversampled = resample(baseband, 5, 1);
back2baseband = resample(oversampled, 1, 5);
symbols2 = ofdmdemod(back2baseband, Nfft, CPlen);
plot(symbols2(:), '.');

When I run the code, I expect that the symbol constellation should be (roughly) the same as the original 16-QAM constellation, but instead I get this:

enter image description here

As a result, I get a BER of about 1% with no noise in my simulation... clearly I am doing something wrong. What is the right way to demodulate an oversampled OFDM signal in MATLAB? I tried using the DigitalUpConverter and DigitalDownConverter objects as well, but that was a total disaster.

EDIT: Thanks to Dan's answer below, I realized that the filters that MATLAB applies when downsampling induced a linear phase shift so I was looking at the wrong sample. When I just do back2baseband = oversampled(1:5:end) I recover the ideal constellation.


1 Answer 1


The result of your plot is what you would see when you have timing offset error but no frequency error. Given that it is over-sampled you can confirm this by manually adjusting your decision point a few samples either way. Even better plot out an eye diagram such as what I show below with all your samples for 16 QAM and it should be clear from that if this is indeed the issue.

(With as little as 2 samples per symbol you can completely replicate the eye diagram as in the plots below using the MATLAB "resample" command).

Consider the eye diagram on the right showing the real and imaginary components on the upper and lower graph, and if we sample at time T=0, we should see tiny dots at all the expected locations for 16QAM on an IQ constellation such as the one you show. If we shifted the sampling decision points to the right or left (timing offset), I believe the IQ constellation would look similar to what you show.

Eye Diagram 16 QAM

  • $\begingroup$ Thanks for the response, I will definitely look into this tomorrow. What do RRC and RC stand for in the figure? $\endgroup$
    – Andrew
    Jan 9, 2020 at 4:06
  • $\begingroup$ They don't really apply to what you are doing with OFDM but those were the pulse shaping filters for a traditional single-channel QAM radio implementation: Root Raised Cosine and Raised Cosine. This is just a slide from one of my classes that happened to show an example of a 16QAM eye diagram. Do you know what the eye diagram is and how you can create one yourself? that would be a more important question if you didn't. $\endgroup$ Jan 9, 2020 at 4:09
  • $\begingroup$ Okay, thanks, I'm familiar with eye diagrams. This makes sense because I'm sure under the hood the resample function is doing all sorts of filtering that induces time delays... $\endgroup$
    – Andrew
    Jan 9, 2020 at 4:14
  • $\begingroup$ Exactly- and to the extent your interested you now have a great opportunity to learn about how a real receiver does timing recovery to correct for this. $\endgroup$ Jan 9, 2020 at 4:17
  • $\begingroup$ If it was that, please post your corrected constellation too $\endgroup$ Jan 9, 2020 at 4:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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