I need to write a MATLAB function to estimate the best initial sampling point for demodulation of a 16-QAM.

I can do it by looking at the eye diagram, the point which at which the eye is "open", but can this be done in MATLAB?


An eye diagram can be created by just framing up your QAM signal (probably after matched filtering), where the frame length is the number of samples per QAM symbol. In MATLAB, this is very simple:

x = output_of_matched_filter;
N = number_of_samples_per_symbol;
eye = reshape(x,N,[]);
% "eye" now is a two-dimensional matrix, with each column containing one trace
% to plot on the eye diagram. you can then plot all of the traces with:

One note: the call to reshape requires that the length of x is a multiple of N. If it isn't already, you'll need to slice the array to make it true:

nsyms = floor(length(x)/N);
eye = reshape(x(1:nsyms*N),N,nsyms);
  • $\begingroup$ This assumes that the signal rate is perfectly constant, and a perfect submultiple of the sampling rate, right? I'd suspect crystals get out of sync slightly and smear the eye diagram and the length of each trace should be slightly variable? It should be based on an actual symbol positions like an oscilloscope rather than assuming each is exactly the same length? $\endgroup$ – endolith Nov 15 '12 at 15:30
  • 4
    $\begingroup$ You're right. I took this as more of a MATLAB "how-to" question than a "how to build the best QAM demodulator" question. The dirty secret that they rarely talk about in communications curriculum: synchronization is hard! Depending upon the characteristics of your system, you might need to track changes in frequency, phase, and/or symbol timing over time and adjust accordingly. $\endgroup$ – Jason R Nov 15 '12 at 15:48
  • $\begingroup$ Thanks a bunch Jason, I already had the eye diagram. It was suppose to be done without help of eye diagrams and the answer was calculating signal energy at different sampling points. Maximum energy relates to synchronisation. $\endgroup$ – Rajan Soni Nov 17 '12 at 4:57
  • $\begingroup$ @RajanSoni You can use maximum energy points, but it is more common to use zero-crossing points to figure out where the symbol boundaries are, and then sample half-way in between. $\endgroup$ – Jim Clay Nov 19 '12 at 15:38
  • $\begingroup$ @JasonR "The dirty secret that they rarely talk about in communications curriculum: synchronization is hard!". Yes, yes, and yes. Why is this so under-stated? :-/ $\endgroup$ – Spacey Nov 19 '12 at 16:11

Your Answer

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

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