From: Yaseen Al-Hasan on 1 Aug 2010 06:03 Hi , I have the following problem: I receive the same BER for all varying SNR values (BER around 50%). May somebody give me an advice? My code is: clc; clear; close all % Create Rayleigh fading channel object. chan = rayleighchan(1/10000,100); % Generate data and apply fading channel. M = 2; % BPSK modulation order tx = ones(1,50000); % Random bit stream pskSig = pskmod(tx,M); % BPSK signal fadedSig = filter(chan,pskSig); % Effect of channel % Compute error rate for different values of SNR. SNR = 0:2:20; % Range of SNR values, in dB. for n = 1:length(SNR) rxSig = awgn(fadedSig,SNR(n)); % Add Gaussian noise. rx = pskdemod(rxSig,M); % Demodulate. % Compute error rate. % Ignore first sample because of DPSK initial condition. [nErrors, BER(n)] = biterr(tx(2:end),rx(2:end)); end % Compute theoretical performance results, for comparison. BERtheory = berfading(SNR,'psk',M,1); % Plot BER results. semilogy(SNR,BERtheory,'b-',SNR,BER,'r*'); legend('Theoretical BER','Empirical BER'); xlabel('SNR (dB)'); ylabel('BER'); title('Binary DPSK over Rayleigh Fading Channel'); thanks
|
Pages: 1 Prev: plotting highest point in filled contour Next: run my code 10 times - automatically |