Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

% written by Hung Nguyen-Le; Nov.

28, 2010 % This program provides BER performance of Digital modulations over % wireless/wireline channels close all; clear all; %============ System settings in the simulation============================ M = 4; %Modulation level of M-ary quadrature amplitude modulation (MQAM), e.g., BPSK -> M=2; QPSK -> M =4; ...... B = log2(M); % number of bits to be conveyed by one MQAM complex symbol N = 1e3; % number of MQAM complex symbols per one transmission burst/frame num_trials = 10; % number of trials, e.g., the number of bursts to be transmitte d in the simulation SNR = [0:5:20]; % signal-to-noise ratios (SNRs) are considered in the simulation %------------------------------------------------------------------------sig_power = signal_power_computation(M); % average MQAM symbol energy; ***Plea se extend to the case of M >2 BER_AWGN = zeros(1,length(SNR)); % contain bit error rate values of the simula tion under AWGN channels BER_fading = zeros(1,length(SNR)); BER_noCSI = zeros(1,length(SNR)); for index = 1:length(SNR) No = sig_power/( 10^( SNR(index)/10 ) ); % noise sample variance or noise po wer for loop = 1:num_trials % Bit generation at transmitter bit_seq = rand(1,B*N) > .5; % uncoded or coded binary bits to be transmi tted bit_noise+rand(1,B*N)<0.1;% Chuoi Bit gay nhieu den mang nhanh thuc % Digital modulation [tx_sig] = MQAM_modulator( reshape(bit_seq,B,N) ); % transmitted signal [tx_noise]=MQAM_modulator( reshape(bit_noise,B,N) ); % transmitted nois e % over AGWN channel (e.g.,wireline channels) noise_samples = sqrt(No/2)*( randn(1,N) + j*randn(1,N) ); % AWGN noise samples rx_sig_AWGN = tx_sig +tx_noise+noise_samples; % received signal over A WGN channels [reco_bit_AWGN] = MQAM_Demodulator_AWGN(rx_sig_AWGN,M); %Bit detection u nder MQAM modulation %-----------------***Please extend to the case of M >2------------% over fading channels (e.g., wireless channels), assuming perfect chann el estimation has % been established by existing techniques, i.e., h is perfectly known at the receiver h = sqrt(1/2)*( randn(1,N) + j*randn(1,N) ); % Generation of Rayleigh fa ding gains rx_sig_fading = h.*tx_sig +tx_noise+ noise_samples; % received signal ov er fading channels [reco_bit_fading] = MQAM_Demodulator(rx_sig_fading,h,M);% Bit detection under MQAM modulation over wireless channels % Consider the case of wireless channels without channel state % information (CSI) at receiver, i.e., ignore the presence of fading gai ns h in the received signal [reco_bit_noCSI] = MQAM_Demodulator_AWGN(rx_sig_fading,M); %Bit detectio

n under MQAM modulation %----*** Please consider the case of multipath fading where channel impl use response is {h_0, h_1} *** % Count the number of error bits occuring BER_AWGN(index) = BER_AWGN(index) + sum( abs(bit_seq - reco_bit_AWGN ) ); BER_fading(index) = BER_fading(index) + sum( abs(bit_seq - reco_bit_fadi ng) ); BER_noCSI(index) = BER_noCSI(index) + sum( abs(bit_seq -reco_bit_noCS I) ); end end BER_noCSI = BER_noCSI/(B*N*num_trials) BER_fading = BER_fading/(B*N*num_trials) BER_AWGN = BER_AWGN/(B*N*num_trials) figure(1) semilogy(SNR,BER_noCSI,'k^--','LineWidth',2); hold on; semilogy(SNR,BER_fading,'ro-','LineWidth',2); hold on; semilogy(SNR,BER_AWGN,'s-','LineWidth',2); hold on; xlabel('SNR (dB)'); ylabel('Bit error rate (BER)'); legend( 'Wireless transmission without CSI',... 'Wireless transmission with CSI',... 'Wireline transmission, i.e., AWGN channels'); figure(2) subplot(3,1,1); plot(real(tx_sig),imag(tx_sig),'ro','LineWidth',2); xlim([min(real(rx_sig_fading)) max(real(rx_sig_fading))]); ylim([min(imag(rx_sig_fading)) max(imag(rx_sig_fading))]); legend( 'MQAM constellation at transmitter'); subplot(3,1,2); plot( real(rx_sig_AWGN),imag(rx_sig_AWGN),'o'); xlim([min(real(rx_sig_fading)) max(real(rx_sig_fading))]); ylim([min(imag(rx_sig_fading)) max(imag(rx_sig_fading))]); legend( 'MQAM constellation at receiver over AWGN channels'); subplot(3,1,3); plot( real(rx_sig_fading),imag(rx_sig_fading),'ko'); xlim([min(real(rx_sig_fading)) max(real(rx_sig_fading))]); ylim([min(imag(rx_sig_fading)) max(imag(rx_sig_fading))]); legend( 'MQAM constellation at receiver over wireless channels');

You might also like