Apr 30, 2012 #1 D David83 Advanced Member level 1 Joined Jan 21, 2011 Messages 410 Helped 45 Reputation 92 Reaction score 45 Trophy points 1,308 Activity points 3,639 Hello 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
Hello 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