Hi Ali,
please try to run the following code:
M = 16;
k = log2(M);
n = 3e4;
nsamp = 1;
hMod = modem.qammod(M);
x = randint(n,1);
stem(x(1:40),'filled');
title('Random Bits');
xlabel('Bit Index'); ylabel('Binary Value');
xsym = bi2de(reshape(x,k,length(x)/k).','left-msb');
figure;
stem(xsym(1:10));
title('Random Symbols');
xlabel('Symbol Index'); ylabel('Integer Value');
y = modulate(modem.qammod(M),xsym);
ytx = y;
EbNo = 10;
snr = EbNo + 10*log10(k) - 10*log10(nsamp);
ynoisy = awgn(ytx,snr,'measured');
yrx = ynoisy;
h = scatterplot(yrx(1:nsamp*5e3),nsamp,0,'g.');
hold on;
scatterplot(ytx(1:5e3),1,0,'k*',h);
title('Received Signal');
legend('Received Signal','Signal Constellation');
axis([-5 5 -5 5]);
hold off;
After you have run the code you should have the following variables in your workspace:
whos
Name Size Bytes Class Attributes
EbNo 1x1 8 double
M 1x1 8 double
h 1x1 8 double
hMod 1x1 modem.qammod
k 1x1 8 double
n 1x1 8 double
nsamp 1x1 8 double
snr 1x1 8 double
x 30000x1 240000 double
xsym 7500x1 60000 double
y 7500x1 120000 double complex
ynoisy 7500x1 120000 double complex
yrx 7500x1 120000 double complex
ytx 7500x1 120000 double complex
Please compare these values with yours in order to hunt down the issue.
I hope I could help,
Friedrich
Best Answer