Code covered by the BSD License  

Highlights from
BER of M-QAM over Rayleigh channel

image thumbnail

BER of M-QAM over Rayleigh channel

by

 

This program gives simulated results of BER over Rayleigh fading channel.

QAM_rayleigh(M, EbNodB)
function[ber]= QAM_rayleigh(M, EbNodB)
 
% Transmission of data by M-QAM modulation
k=log2(M);
EbNo=10^(EbNodB/10);
N=k*10^4;
x=0+(1-0)*round(rand(1,N))';
h=modem.qammod(M);
h.inputtype='bit';
h.symbolorder='gray';
y=modulate(h,x);
 
% Rayleigh Channel operations
m=mean((abs(y)).^2)/k;
sigma=sqrt(m/(2*EbNo));
w=sigma*(randn(N/k,1)+1i*randn(N/k,1));
H=(1/sqrt(2))*(randn(N/k,1)+1i*randn(N/k,1));
r=H.*y+w;
 
% M-QAM decoder operations & BER Calculation
r=r./H;
h_n=modem.qamdemod(M);
h_n.outputtype='bit';
h_n.symbolorder='gray';
h_n.decisiontype='hard decision';
z=demodulate(h_n,r);
ber=(N-sum(x==z))/N;

Contact us