C?sar Ghali wrote:
> Dear friends,
>
> I am trying to simulate a Wireless Channel with Rayleigh fading and AWGN noise, and here is the problem:
>
> I am using the following code which I found in MATLAB help:
>
>
> modType = 'dpsk'; % 'dpsk' or 'bpsk'
> chanType = 'fading'; % 'fading' or 'nofading'
>
> chan = rayleighchan(1/10000,100);
>
> M = 2;
> if strcmp(modType, 'dpsk')
> hMod = modem.dpskmod('M', M);
> hDemod = modem.dpskdemod(hMod);
> elseif strcmp(modType, 'bpsk')
> hMod = modem.pskmod('M', M);
> hDemod = modem.pskdemod(hMod);
> end
>
>
> tx = randint(50000,1,M);
> dpskSig = modulate(hMod, tx);
>
> % AWGN Only
> if strcmp(chanType, 'nofading')
> fadedSig = dpskSig;
> elseif strcmp(chanType, 'fading')
> fadedSig = filter(chan,dpskSig);
> end
>
> SNR = 0:1:20;
> for n = 1:length(SNR)
> rxSig = awgn(fadedSig,SNR(n));
> rx = demodulate(hDemod, rxSig);
> %reset(hDemod);
>
> [nErrors, BER(n)] = biterr(tx,rx);
> end
>
> if strcmp(modType, 'dpsk')
> BERtheory = berfading(SNR,'dpsk',M,1);
> elseif strcmp(modType, 'bpsk')
> BERtheory = berfading(SNR,'psk',M,1);
> end
>
> % Plot BER results.
> semilogy(SNR,BERtheory,'b',SNR,BER,'r*');
> legend('Theoretical BER','Empirical BER','Location','Southwest');
> xlabel('SNR (dB)'); ylabel('BER');
> title('Binary DPSK over Rayleigh Fading Channel');
>
>
> The following combinations of the modulation scheme and channel type works:
> dpsk fading, dpsk nofading, bpsk nofading
>
> By using the previous three combinations; the empirical curve matches the theoretical curve but by using bpsk modulation scheme with a fading channel results in a strange results.
>
> If I try the following chunk of code:
>
>
> modType = 'psk'; % 'dpsk' or 'bpsk'
> chanType = 'fading'; % 'fading' or 'nofading'
>
> chan = rayleighchan(1/10000,100);
>
> M = 2;
> if strcmp(modType, 'dpsk')
> hMod = modem.dpskmod('M', M);
> hDemod = modem.dpskdemod(hMod);
> elseif strcmp(modType, 'bpsk')
> hMod = modem.pskmod('M', M);
> hDemod = modem.pskdemod(hMod);
> end
>
> message = randint(1,5,M)
> signal = modulate(hMod, message)
> rx = filter(chan, signal)
> decode = demodulate(hDemod, rx)
>
>
> I noticed that the decode vector have the exactly opposite value of the vector message (0s become ones and vice versa), this will of course lead to a approximately bit error rate equal to 0.5. In addition, I noticed also that the rx vector (after the effect of the channel) have the opposite sign of the vector signal.
>
> My objective is to use bpsk with a fading channel.
>
> Can anyone help me.
>
> Thanks in advance for your help.
>
>
> Cesar Ghali
Cesar,
The above code looks like the example in the doc on using fading
channels, but that code uses differential encoding. The same code will
*not* work for nondifferential encoded PSK. In the differential
encoded system, the information is transmitted in the phase *difference*
between consecutive channel symbols. In nondiff PSK, the information
is carried in the absolute phase of each symbol.
Thus, in the first case (DBPSK) one can demodulate the signal without an
equalizer (or any estimate of the channel phase). In the latter case
(BPSK), you must somehow undo the effect of the fading channel phase,
otherwise you can't demodulate (i.e. you need to use an equalizer, or
estimate the channel phase somehow).
For BPSK, you must also use pilot symbols. Otherwise you will not be
able to resolve the 180degree ambiguity at the receiver (i.e. with no
noise, you will either detect your signal with zero errors or 100% errors).
You need to look at examples that do not use differential encoding, and
see how they account for the phase of the channel.
HTH,
Idin
