From: "Ethem Sozer" <>
Newsgroups: comp.soft-sys.matlab
Subject: Re: BER for BPSK
Date: Wed, 13 Jan 2010 10:13:05 -0500
Organization: The MathWorks, Inc.
Lines: 58
Message-ID: <hiknu3$39j$>
References: <hikkr8$cra$>
Reply-To: "Ethem Sozer" <>
X-Trace: 1263395587 3379 (13 Jan 2010 15:13:07 GMT)
NNTP-Posting-Date: Wed, 13 Jan 2010 15:13:07 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
Xref: comp.soft-sys.matlab:598532

Hi Saed,

You are on the right track: the problem is phase recovery.  You need to 
correct the phase for the PSK demodulator to recover the received bits.

The Rayleigh channel object of the Communications Toolbox provides the 
"PathGains" property where you can see the channel gain used to generate the 
received signal.  You can access this value using the syntax: 
chan.PathGains, and use it to correct the fading effect of the channel.  By 
default, this property only shows the last channel gain used.  To store 
channel gain values for the whole frame, you need to set the StorePathGains 
to 1 as follows:

chan.StorePathGains = 1;

Note that this will work for only flat fading channels.  If you have 
selective fading, then you will need an equalizer.

By the way, to see the full effect of the fading, you need to put the 
channel filter inside the for loop.

Good luck,

"Saed Dawoud" <> wrote in message 
> Hello,
> I am trying to simulate the Bit Error Rate (BER) for Binary Phase Shift 
> Keying (BPSK) over Rayleigh fading channel, and I come up with the 
> following code, which is a slightly modefied version of the one in MATLAB 
> Communication Toolbox for DPSK:
> M=2;
> chan=rayleighchan(1/10000,100);
> tx=randint(50000,1,M);
> txSig=pskmod(tx,M);
> y=filter(chan,txSig);
> SNR=0:2:20;
> for n=1:length(SNR)
>    rxSig=awgn(y,SNR(n));
>    rx=pskdemod(rxSig,M);
>    [nErrors,BER(n)]=biterr(tx,rx);
> end
> BERtheory = berfading(SNR,'psk',M,1);
> semilogy(SNR,BER,'k-*',SNR,BERtheory,'r');
> As you noted, something is wrong in this code, since the empirical result 
> is far away from the theoritical one, where it is expected for both to be 
> almost the same. This situation is not arised in the case of DPSK, so, I 
> think the reason is the phase recovery, but I don't know how to solve this 
> problem. Can anyone help me?
> Thanks in advance