Path: news.mathworks.com!not-for-mail
From: "Ethem Sozer" <esozer@mathworks.com>
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$1@fred.mathworks.com>
References: <hikkr8$cra$1@fred.mathworks.com>
Reply-To: "Ethem Sozer" <esozer@mathworks.com>
NNTP-Posting-Host: sozere.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1263395587 3379 144.212.109.241 (13 Jan 2010 15:13:07 GMT)
X-Complaints-To: news@mathworks.com
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: news.mathworks.com 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,
Ethem

"Saed Dawoud" <saed.dawoud@yahoo.com> wrote in message 
news:hikkr8$cra$1@fred.mathworks.com...
> 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