Week1
Week 1:
Complete the Analytic BER and Simulated BER for both Bipolar and Unipolar NRZ waveform. This result can be seen in Figure 1, the Analytic and Simulated results are shown below. The code of this task will also be pasted at the end of this post.
![]() |
Figure 1. BER performance for both Unipolar and Bipolar NRZ |
From this task, the basic information of Additive White Gaussian Noise (AWGN) channel and connection between the BER and SNR (or Eb/N0) were obtained. However, student should pay more attention on the Match Filter and Time-domain Selected Mapping (TSLM) in following study.
Moreover, the related information, such as Cyclic Prefix (CP), InterSymbol Interference (ISI) and Discrete Fourier Transform (DFT or FFT), are gathered from online sources.
The articles, 'PA-Efficiency-Aware Hybrid PAPR Reduction for F-OFDM Systems with ICA Based Blind Equalization' and 'A New SLM OFDM Scheme With Low Complexity for PAPR Reduction' have been analyzed to begin this project.
Generally, the first article is more helpful because it proposed a hybrid method to reduce the PAPR. This means it has several different methods or techniques to realize this goal and students can have a intuition from these processes, although this seems complicated at first.
MATLAB Code (Please run Bipolar first, then Unipolar, so four simulations can exist in a single figure):
BipolarNRZ_AWGN.m
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | %UnipolarNRZ_AWGN.m Simulate the performance of Unipolar NRZ in AWGN channels clear all; close all; %Eb/N0 in dB Eb_N0_dB=0:1:10; %Convert Eb/N0 into the linear scale Eb_N0=10.^(Eb_N0_dB/10); %Fix the average bit engergy to be 1 Eb=1; %Fix the bit duration to be 1 T=1; %Calculate the signal amplitude %Or you can also change the amplitude from 2Eb to Eb A= sqrt (Eb/T); %Engergy of bit 0 %E0=0; E0=A^2*T; %Engergy of bit 1 E1=A^2*T; %Optimal threshold Thr=(E1-E0)/2; %Matched filter impulse response--constant with amplitude A over one bit %duration. h=A; %Calculate the correspnding noise power spectral density %Bipolar Eb = 2 Unipolar Eb N0=Eb./Eb_N0; %Number of different SNRs len_EbN0=length(Eb_N0); %Total number of bits per block N_bit=100000; %Maximum number of blocks to simulate N_block=1000; %Eb/N0 index pointer EbN0_pointer=1; temp_EbN0_pointer=EbN0_pointer; %Number of errors counted for each Eb/N0 errs=zeros(1,len_EbN0); %Number of blocks simulated for each Eb/N0 block_count=zeros(1,len_EbN0); %While the Eb/N0 index pointer has not reached the last value, and the %number of blocks has not exceeded the maximum number, N_block, % do the iterations while (EbN0_pointer <= len_EbN0) && (block_count(len_EbN0) < N_block) %Generate a binary bit sequence D=round( rand (1,N_bit)); %D= rand (1,N_bit); F = zeros(1, N_bit); F (D == 1) = 1; F (D == 0) = -1; %Transmitted signal after unipolar NRZ line coding. %1 is mapped to amptitude A; 0 is mapped to amptitude 0. Tx_data = A*F; % Tx_data = A*randsrc(1, N_bit); %AWGN with normalised power 1 Noise=randn(1, N_bit); %Simulate different Eb/N0 values for n = EbN0_pointer : len_EbN0 %Standard deviation of AWGN sigma_AWGN= sqrt (N0(n)/2); %Received signal . The noise power is N0(n). Rx_data = Tx_data + sigma_AWGN*Noise; %Matched filter output signal V=h*Rx_data; %Recover the transmit data from the received data. %When the MF output is V>Th, output 1; otherwise output 0. Recov_data = zeros (1,N_bit); Recov_data (V>Thr)=1; % Recov_data = sign(Rx_data); %Count the number of errors errs(n)= errs(n)+sum( abs (Recov_data-D)); % errs(n) = errs(n) + sum( abs (Recov_data - Tx_data)); %If more than 500 errors have been counted, move the Eb/N0 %index pointer to the next Eb/N0 if errs(n)>=500 temp_EbN0_pointer = temp_EbN0_pointer+1; end %Update the nubmer of blocks simulated block_count(n)=block_count(n)+1; end %Update Eb/N0 pointer EbN0_pointer=temp_EbN0_pointer; block_count; end %Calculate the numerical BERs for different Eb/N0's. Each block has N_bit bits. Num_BER = errs./(N_bit*block_count); %Calculate the analytical BERs for different Eb/N0's Ana_BER=Random_Q( sqrt (2*Eb_N0)); figure; semilogy(Eb_N0_dB, Num_BER, '-s' ); hold on; semilogy(Eb_N0_dB, Ana_BER, 'r-*' ); grid on; % legend1( 'Bipolar Numerical BER' , 'Bipolar Analytical BER' ); title( 'NRZ in AWGN Channels' ); xlabel( 'Eb/N0 (dB)' ); ylabel( 'BER' ); |
UnipolarNRZ_AWGN.m
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | %UnipolarNRZ_AWGN.m Simulate the performance of Unipolar NRZ in AWGN %channels % clear all; % close all; %Eb/N0 in dB Eb_N0_dB=0:1:10; %Convert Eb/N0 into the linear scale Eb_N0=10.^(Eb_N0_dB/10); %Fix the bit engergy to be 1 Eb=1; %Fix the bit duration to be 1 T=1; %Calculate the signal amplitude A= sqrt (2*Eb/T); %Engergy of bit 0 E0=0; %Engergy of bit 1 E1=A^2*T; %Optimal threshold Thr=(E1-E0)/2; %Matched filter impulse response--constant with amplitude A over one bit %duration. h=A; %Calculate the correspnding noise power spectral density N0=Eb./Eb_N0; %Number of different SNRs len_EbN0=length(Eb_N0); %Total number of bits per block N_bit=10000; %Maximum number of blocks to simulate N_block=1000; %Eb/N0 index pointer EbN0_pointer=1; temp_EbN0_pointer=EbN0_pointer; %Number of errors counted for each Eb/N0 errs=zeros(1,len_EbN0); %Number of blocks simulated for each Eb/N0 block_count=zeros(1,len_EbN0); %While the Eb/N0 index pointer has not reached the last value, and the %number of blocks has not exceeded the maximum number, N_block, % do the iterations while (EbN0_pointer <= len_EbN0) && (block_count(len_EbN0) < N_block) %Generate a binary bit sequence D=round( rand (1,N_bit)); %Transmitted signal after unipolar NRZ line coding. %1 is mapped to amptitude A; 0 is mapped to amptitude 0. Tx_data = A*D; %AWGN with normalised power 1 Noise=randn(1, N_bit); %Simulate different Eb/N0 values for n = EbN0_pointer : len_EbN0 %Standard deviation of AWGN sigma_AWGN= sqrt (N0(n)/2); %display(sigma_AWGN); %Received signal . The noise power is N0(n). Rx_data = Tx_data + sigma_AWGN*Noise; %Matched filter output signal V=h*Rx_data; %Recover the transmit data from the received data. %When the MF output is V>Th, output 1; otherwise output 0. Recov_data = zeros (1,N_bit); Recov_data (V>Thr)=1; %Count the number of errors errs(n)= errs(n)+sum( abs (Recov_data-D)); %If more than 500 errors have been counted, move the Eb/N0 %index pointer to the next Eb/N0 if errs(n)>=500 temp_EbN0_pointer = temp_EbN0_pointer+1; end %Update the nubmer of blocks simulated block_count(n)=block_count(n)+1; end %Update Eb/N0 pointer EbN0_pointer=temp_EbN0_pointer; block_count; end %Calculate the numerical BERs for different Eb/N0's. Each block has N_bit %bits. Num_BER = errs./(N_bit*block_count); %Calculate the analytical BERs for different Eb/N0's Ana_BER=Random_Q( sqrt (Eb_N0)); % figure; semilogy(Eb_N0_dB, Num_BER, 'g-+' ); hold on; semilogy(Eb_N0_dB, Ana_BER, 'b-o' ); grid on; legend( 'Bipolar Numerical BER' , 'Bipolar Analytical BER' , 'Unipolar Numerical BER' , 'Unipolar Analytical BER' ); title( 'NRZ in AWGN Channels' ); xlabel( 'Eb/N0 (dB)' ); ylabel( 'BER' ); |
Random_Q.m
1 2 3 4 | %Q function function y=Random_Q(x) x=real(x); y=erfc(x/ sqrt (2))/2; |
Comments
Post a Comment