Reply by centuriaky December 13, 20032003-12-13
hi all,

Below is the QPSK i have done to calculate the BER. However, the
dectection part is wrong. Can anyone advise what is the correct
syntax.

Appreciate the help greatly. Thanks %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%
% MATLAB Code for QPSK
% performs the calculatation of the BER for the given value of
SNR_db

numSym; % Generate number
of symbols to send
bits_per_symbol=2;
N=bits_per_symbol*numSym;
M=4; % QPSK modulation.
1 symbol consists 2 bits
SNR_db=1:0.5:13; % SNR range for
per bit

rand('state',12345)
randn('state',54321)

BER = zeros(1,prod(size(SNR_db))); % generate BER
metric dimension the same as SNR_db

for count=1:length(SNR_db)

msg_orig=randsrc(numSym,1,[1:M]);
QPSK=[1+i -1+i -1-i 1-i];
tx_signal=QPSK([msg_orig]);
noise=sqrt(1/(2*log(M)*10^(SNR_db(count)/10)))*(rand(1,numSym)
+j*rand(1,numSym));

rx_signal=tx_signal+noise
rx_signal=rx_signal(:)
a=[ 1 2 3 4]';
c=complex(a);
decis=c([rx_signal-1]) end