Estimating optimum sampling point for 16-QAM 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:
plot(eye);


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);