David83
Advanced Member level 1
Hello
I am trying to simulate 16-QAM over Rayleigh fading channel with following code:
but it does not work. What is wrong?
Thanks
I am trying to simulate 16-QAM over Rayleigh fading channel with following code:
Code:
clear all;
clc;
SNRdB=0:20;
SNR=10.^(SNRdB./10);
nErr=zeros(1,length(SNR));
NofSymbols=zeros(1,length(SNR));
Ne=1000;
for ii=1:length(SNR)
count=0;
while nErr(ii)<=Ne
count=count+1;
z=randi([0 15],1,10);
s=qammod(z,16);
h=(1/sqrt(2)).*(randn(1,10)+1i.*randn(1,10));
n=(1/sqrt(2*SNR(ii))).*(randn(1,10)+1i.*randn(1,10));
y=h.*s+n;
sHat=qamdemod(y,16);
nErr(ii)=nErr(ii)+sum(sHat~=s);
end
NofSymbols(ii)=count*10;
end
SER=nErr./NofSymbols;
semilogy(SNRdB,SER)
but it does not work. What is wrong?
Thanks