Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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);
share|improve this answer
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? – endolith Nov 15 '12 at 15:30
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. – Jason R Nov 15 '12 at 15:48
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. – Rajan Soni Nov 17 '12 at 4:57
@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. – Jim Clay Nov 19 '12 at 15:38
@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? :-/ – Mohammad Nov 19 '12 at 16:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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