%QAM Tutorial2
%JC 8/29/07
%Run from editor debug(F5)
%This m-file(visualization tool) attempts to calculate the theoretical exact(in AWGN)
%SYMBOL ERROR RATE(Ps_SER) verses Eb/No for even numbers of bits per symbol.
%4QAM,16QAM,64QAM,256QAM,and 1024QAM rectangular systems are
%shown. Gray coding is assumed(freebe). No bells or whistles are presented in the
%code for automated(for loops) use such as waterfall figures, etc. The user can
%observe different values in the command window. Plug in the k and AVGSNRb in dB
%values as required and UNCOMMENT the corresponding Ps_SER. Reference to the
%equations used to get the Ps_SER equations are shown in the notes.
%Also, Eb/No(SNR) m-file calculated values in dB at ~1e-5 SER for each constellation
%are shown in the notes. These values compare closely with Prokis's Figure(5.2-17 on
%page 282) in the Bandwidth-limited region realizing that 256QAM and 1024QAM
%are not shown. I'm just trying to compare apples with apples and reproduce the same
%results and determine the coding gain required to closely approach Shannon's channel
%capacity limit. It appears from interpolation of the graph and comparison, using the
%equation(notes), that the different levels of QAM need approximately 6 to 9dB of coding
%gain to achieve this. Turbo trellis coded modulation and its derivatives gets us
%approximatley 4 to 7dB(depending on SER)so we are getting close to the limit.
%======================================================================
clear;
k=10;%number bits per symbol-use even 2,4,,6,8,10 for rectangular constellation plots
M=2^k;%M=4,16,64,256,1024
AVGSNRb=28.5%Eb/No (bit) in dB
AVGSNRs=k*10^(AVGSNRb/10);%Es/No (symbol)
x=(sqrt(3*AVGSNRs/(M-1)));%Q(x)
Q=.5*erfc(x/1.414);%Q function
%Ps_SER=2*Q-Q^2%4QAM-same as QPSK symbol error rate(SER)
%Ps_SER=3*Q-2.25*Q^2%16QAM
%Ps_SER=3.5*Q-3.0625*Q^2%64QAM----Uncomment only one Ps_SER
%Ps_SER=3.75*Q-3.515*Q^2%256QAM
Ps_SER=3.875*Q-3.753*Q^2%1024QAM
Pb_BER=Ps_SER/k%This is an approximation
%=========================================================================
%Notes
%Prokis(Digital Communications),fourth edition,page 278,equations(5.2-78) and(5.2-79)
%Coding gain required to closely approach
%Shannon's channel capacity limit
%@~1e-5 SER (C/W)=(k/1)
% M Eb/No(SNR)@~1e-5 SER Coding gain=10Log(2^(k)/k)-Eb/No(SNR)@~1e-5 SER
% 4QAM 9.85dB 9.85dB-3.01dB=6.84dB
% 16QAM 14.03dB 14.03dB-6.02dB=8.01dB
% 64QAM 18.55dB 18.55dB-10.28dB=8.27dB
% 256QAM 23.39dB 23.39dB-15.05dB=8.34dB
% 1024QAM 28.50dB 28.50dB-20.10dB=8.40dB
%The above values show that to achieve the same SER using 1024QAM instead
%of 256QAM an additional approximate 5.11dB average bit energy/noise
%spectral density Ebavg/No gain is required.(Increase Transmitter Power)
%QAM has good bandwidth efficiency as compared to PSK and takes less coding
%gain.
%QAM is a good candidate for systems requiring extremely high bit rates and
%is not transmitter power limited such as cable,telephone,digital
%microwave,etc.
%One thought is worth 100 words[Eb/No-before coding Es/No-after
%coding]
%When observing charts of error rates(SER,BER),one must be aware of the
%definition of SNR,S/N, Eb/No,Eav,or Es/No used and make the conversion for
%correct results.
%Good Luck